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

SimplePie::get_type() WP 1.0

Get the type of the feed

This returns a SIMPLEPIE_TYPE_* constant, which can be tested against using bitwise operators

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

  • Смотрите: SIMPLEPIE_TYPE_NONE Unknown.
  • Смотрите: SIMPLEPIE_TYPE_RSS_090 RSS 0.90.
  • Смотрите: SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
  • Смотрите: SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
  • Смотрите: SIMPLEPIE_TYPE_RSS_091 RSS 0.91.
  • Смотрите: SIMPLEPIE_TYPE_RSS_092 RSS 0.92.
  • Смотрите: SIMPLEPIE_TYPE_RSS_093 RSS 0.93.
  • Смотрите: SIMPLEPIE_TYPE_RSS_094 RSS 0.94.
  • Смотрите: SIMPLEPIE_TYPE_RSS_10 RSS 1.0.
  • Смотрите: SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x.
  • Смотрите: SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS.
  • Смотрите: SIMPLEPIE_TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
  • Смотрите: SIMPLEPIE_TYPE_RSS_ALL Any version of RSS.
  • Смотрите: SIMPLEPIE_TYPE_ATOM_03 Atom 0.3.
  • Смотрите: SIMPLEPIE_TYPE_ATOM_10 Atom 1.0.
  • Смотрите: SIMPLEPIE_TYPE_ATOM_ALL Any version of Atom.
  • Смотрите: SIMPLEPIE_TYPE_ALL Any known/supported feed type.
  • C версии 0.8 (usage changed to using constants in 1.0)

Хуков нет.

Возвращает

Число. SIMPLEPIE_TYPE_* constant

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

$SimplePie = new SimplePie();
$var = $SimplePie->get_type();

Код SimplePie::get type: wp-includes/class-simplepie.php WP 5.2.1

<?php
public function get_type()
{
	if (!isset($this->data['type']))
	{
		$this->data['type'] = SIMPLEPIE_TYPE_ALL;
		if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
		{
			$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
		}
		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
		{
			$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
		}
		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
		{
			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
			{
				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
			}
			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
			|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
			{
				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
			}
		}
		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
		{
			$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
			{
				switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
				{
					case '0.91':
						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
						if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
						{
							switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
							{
								case '0':
									$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
									break;

								case '24':
									$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
									break;
							}
						}
						break;

					case '0.92':
						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
						break;

					case '0.93':
						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
						break;

					case '0.94':
						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
						break;

					case '2.0':
						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
						break;
				}
			}
		}
		else
		{
			$this->data['type'] = SIMPLEPIE_TYPE_NONE;
		}
	}
	return $this->data['type'];
}