WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

SimplePie_Item::get_categories() public WP 3

Get all categories for the item

Uses <atom:category>, <category> or <dc:subject>

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

Хуков нет.

Возвращает

SimplePie_Category[]/null. List of SimplePie_Category{} objects

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

$SimplePie_Item = new SimplePie_Item();
$SimplePie_Item->get_categories();

Список изменений

С версии 3 Введена.

Since Beta 3

Код SimplePie_Item::get_categories() WP 5.5.3

<?php
public function get_categories()
{
	$categories = array();

	$type = 'category';
	foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, $type) as $category)
	{
		$term = null;
		$scheme = null;
		$label = null;
		if (isset($category['attribs']['']['term']))
		{
			$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		if (isset($category['attribs']['']['scheme']))
		{
			$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		if (isset($category['attribs']['']['label']))
		{
			$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		$categories[] = $this->registry->create('Category', array($term, $scheme, $label, $type));
	}
	foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, $type) as $category)
	{
		// This is really the label, but keep this as the term also for BC.
		// Label will also work on retrieving because that falls back to term.
		$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		if (isset($category['attribs']['']['domain']))
		{
			$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		else
		{
			$scheme = null;
		}
		$categories[] = $this->registry->create('Category', array($term, $scheme, null, $type));
	}

	$type = 'subject';
	foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, $type) as $category)
	{
		$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
	}
	foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, $type) as $category)
	{
		$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
	}

	if (!empty($categories))
	{
		return array_unique($categories);
	}

	return null;
}