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

SimplePie::get_links() WP 1.0

Get all links for the feed

Uses <atom:link> or <link>

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

  • C версии Beta 2

Хуков нет.

Возвращает

Массив/null. Links found for the feed (strings)

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

$SimplePie = new SimplePie();
$var = $SimplePie->get_links( $rel );
$rel(строка)
The relationship of links to return
По умолчанию: 'alternate'

Код SimplePie::get links: wp-includes/class-simplepie.php WP 5.2

<?php
public function get_links($rel = 'alternate')
{
	if (!isset($this->data['links']))
	{
		$this->data['links'] = array();
		if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
		{
			foreach ($links as $link)
			{
				if (isset($link['attribs']['']['href']))
				{
					$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
					$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
				}
			}
		}
		if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
		{
			foreach ($links as $link)
			{
				if (isset($link['attribs']['']['href']))
				{
					$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
					$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));

				}
			}
		}
		if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
		{
			$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
		}
		if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
		{
			$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
		}
		if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
		{
			$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
		}

		$keys = array_keys($this->data['links']);
		foreach ($keys as $key)
		{
			if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
			{
				if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
				{
					$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
					$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
				}
				else
				{
					$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
				}
			}
			elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
			{
				$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
			}
			$this->data['links'][$key] = array_unique($this->data['links'][$key]);
		}
	}

	if (isset($this->data['links'][$rel]))
	{
		return $this->data['links'][$rel];
	}
	else
	{
		return null;
	}
}