SimplePie::get_feed_tags

Advertisement

Summery Summery

Get data for an feed-level element

Syntax Syntax

SimplePie::get_feed_tags( string $namespace, string $tag )

Description Description

This method allows you to get access to ANY element/attribute that is a sub-element of the opening feed tag.

The return value is an indexed array of elements matching the given namespace and tag name. Each element has attribs, data and child subkeys. For attribs and child, these contain namespace subkeys. attribs then has one level of associative name => value data (where value is a string) after the namespace. child has tag-indexed keys after the namespace, each member of which is an indexed array matching this same format.

For example:

 // This is probably a bad example because we already support //  natively, but it shows you how to parse through // the nodes. $group = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group'); $content = $group[0]['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']; $file = $content[0]['attribs']['']['url']; echo $file; 

Parameters Parameters

$namespace

(Required) The URL of the XML namespace of the elements you're trying to access

$tag

(Required) Tag name

Return Return

(array)

Source Source

File: wp-includes/class-simplepie.php

		if (!headers_sent())
		{
			$header = "Content-type: $mime;";
			if ($this->get_encoding())
			{
				$header .= ' charset=' . $this->get_encoding();
			}
			else
			{
				$header .= ' charset=UTF-8';
			}
			header($header);
		}
	}

	/**
	 * Get the type of the feed
	 *
	 * This returns a SIMPLEPIE_TYPE_* constant, which can be tested against
	 * using {@link http://php.net/language.operators.bitwise bitwise operators}
	 *
	 * @since 0.8 (usage changed to using constants in 1.0)
	 * @see SIMPLEPIE_TYPE_NONE Unknown.
	 * @see SIMPLEPIE_TYPE_RSS_090 RSS 0.90.
	 * @see SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
	 * @see SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
	 * @see SIMPLEPIE_TYPE_RSS_091 RSS 0.91.
	 * @see SIMPLEPIE_TYPE_RSS_092 RSS 0.92.
	 * @see SIMPLEPIE_TYPE_RSS_093 RSS 0.93.
	 * @see SIMPLEPIE_TYPE_RSS_094 RSS 0.94.
	 * @see SIMPLEPIE_TYPE_RSS_10 RSS 1.0.
	 * @see SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x.
	 * @see SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS.

Advertisement

Changelog Changelog

Changelog
Version Description
1.0 Introduced.

See also See also

Advertisement

Leave a Reply