The Zend_Feed_Abstract class is an abstract class representing feeds.

Zend_Feed_Abstract implements two core PHP 5 interfaces: ArrayAccess and Iterator. In both cases the collection being treated as an array is considered to be the entry collection, such that iterating over the feed takes you through each of the feed.s entries.

category Zend
package Zend_Feed
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Feed_Element

 Methods

Get the value of an element with method syntax.

__call(string $var, mixed $unused) : mixed
Inherited

Map method calls to get the string value of the requested element. If there are multiple elements that match, this will return an array of those objects.

Parameters

$var

string

The element to get the string value of.

$unused

mixed

This parameter is not used.

Returns

mixedThe node's value, null, or an array of nodes.

Feed constructor

__construct(string $uri = null, string $string = null, \Zend_Feed_Builder_Interface $builder = null) : void

The Zend_Feed_Abstract constructor takes the URI of a feed or a feed represented as a string and loads it as XML.

inherited_from \Zend_Feed_Element::__construct()

Parameters

$uri

string

The full URI of the feed to load, or NULL if not retrieved via HTTP or as an array.

$string

string

The feed as a string, or NULL if retrieved via HTTP or as an array.

$builder

\Zend_Feed_Builder_Interface

The feed as a builder instance or NULL if retrieved as a string or via HTTP.

Exceptions

\Zend_Feed_Exception If loading the feed failed.

Zend_Feed_Element constructor.

__construct(\DOMElement $element = null) : void
Inherited

Parameters

$element

\DOMElement

The DOM element we're encapsulating.

Map variable access onto the underlying entry representation.

__get(string $var) : mixed
Inherited

Get-style access returns a Zend_Feed_Element representing the child element accessed. To get string values, use method syntax with the __call() overriding.

Parameters

$var

string

The property to access.

Returns

mixed

Map isset calls onto the underlying entry representation.

__isset(string $var) : boolean
Inherited

Parameters

$var

string

Returns

boolean

Map variable sets onto the underlying entry representation.

__set(string $var, string $val) : void
Inherited

Parameters

$var

string

The property to change.

$val

string

The property's new value.

Exceptions

\Zend_Feed_Exception

Prepare for serialiation

__sleep() : array

Returns

array

Returns the nodeValue of this element when this object is used in a string context.

__toString() : string
Inherited

Returns

string

Remove all children matching $var.

__unset(string $var) : void
Inherited

Parameters

$var

string

Load the feed as an XML DOMDocument object

__wakeup() : void

Exceptions

\Zend_Feed_Exception

Get the number of entries in this feed object.

count() : integer

Returns

integerEntry count.

Required by the Iterator interface.

current() : mixed

Returns

mixedThe current row, or null if no rows.

Get a DOM representation of the element

getDOM() : \DOMDocument
Inherited

Returns the underlying DOM object, which can then be manipulated with full DOM methods.

Returns

\DOMDocument

Get encoding

getEncoding() : string
Inherited

Returns

string

Required by the Iterator interface.

key() : mixed

Returns

mixedThe current row number (starts at 0), or NULL if no rows

Required by the Iterator interface.

next() : mixed

Returns

mixedThe next row, or null if no more rows.

Required by the ArrayAccess interface.

offsetExists(string $offset) : boolean
Inherited

Parameters

$offset

string

Returns

boolean

Required by the ArrayAccess interface.

offsetGet(string $offset) : string
Inherited

Parameters

$offset

string

Returns

string

Required by the ArrayAccess interface.

offsetSet(string $offset, string $value) : string
Inherited

Parameters

$offset

string

$value

string

Returns

string

Required by the ArrayAccess interface.

offsetUnset(string $offset) : boolean
Inherited

Parameters

$offset

string

Returns

boolean

Required by the Iterator interface.

rewind() : void

Get an XML string representation of this element

saveXml() : string
Inherited

Returns a string of this element's XML, including the XML prologue.

Returns

string

Get the XML for only this element

saveXmlFragment() : string
Inherited

Returns a string of this element's XML without prologue.

Returns

string

Send feed to a http client with the correct header

send() : void

Exceptions

\Zend_Feed_Exception if headers have already been sent

Update the object from a DOM element

setDOM(\DOMElement $element) : void
Inherited

Take a DOMElement object, which may be originally from a call to getDOM() or may be custom created, and use it as the DOM tree for this Zend_Feed_Element.

Parameters

$element

\DOMElement

Set encoding

setEncoding(string $value) : \Zend_Feed_Element
Inherited

Parameters

$value

string

Encoding to use

Returns

\Zend_Feed_Element

Set the parent element of this object to another Zend_Feed_Element.

setParent(\Zend_Feed_Element $element) : void
Inherited

Parameters

$element

\Zend_Feed_Element

Required by the Iterator interface.

valid() : boolean

Returns

booleanWhether the iteration is valid

Cache the individual feed elements so they don't need to be searched for on every operation.

_buildEntryCache() : void

Finds children with tagnames matching $var

_children(string $var) : array
Inherited

Similar to SimpleXML's children() method.

Parameters

$var

string

Tagname to match, can be either namespace:tagName or just tagName.

Returns

array

Import a feed from a string

_importFeedFromString(string $feed) : string

Protects against XXE attack vectors.

Parameters

$feed

string

Exceptions

\Zend_Feed_Exception on detection of an XXE vector

Returns

string

Generate the entries of the feed when working in write mode

_mapFeedEntries(\DOMElement $root, array $array) : \DOMElement

Parameters

$root

\DOMElement

the root node to use

$array

array

the data to use

Returns

\DOMElementroot node

Generate the header of the feed when working in write mode

_mapFeedHeaders(array $array) : \DOMElement

Parameters

$array

array

the data to use

Returns

\DOMElementroot node

Appends this element to its parent if necessary.

ensureAppended() : void
Inherited

 Properties

 

$_appended

$_appended : boolean

Default

true
 

$_element

$_element : \DOMElement

Default

 

Character encoding to utilize

$_encoding : string

Default

'UTF-8'
 

Cache of feed entries.

$_entries : array

Default

 

Current index on the collection of feed entries for the Iterator implementation.

$_entryIndex : integer

Default

0
 

$_parentElement

$_parentElement : \Zend_Feed_Element

Default