Feed/Atom.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Feed
- Version
- $Id: Atom.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Feed_Atom
Atom feed class
The Zend_Feed_Atom class is a concrete subclass of the general Zend_Feed_Abstract class, tailored for representing an Atom feed. It shares all of the same methods with its abstract parent. The distinction is made in the format of data that Zend_Feed_Atom expects, and as a further pointer for users as to what kind of feed object they have been passed.
- Parent(s)
- \Zend_Feed_Abstract < \Zend_Feed_Element
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


boolean $_appended = true
true
Details- Type
- boolean
- Inherited_from
- \Zend_Feed_Element::$$_appended
- Inherited_from
- \Zend_Feed_Abstract::$$_appended


string $_defaultNamespace = 'atom'
The default namespace for Atom feeds.
'atom'
Details- Type
- string


\DOMElement $_element =
- Type
- \DOMElement
- Inherited_from
- \Zend_Feed_Element::$$_element
- Inherited_from
- \Zend_Feed_Abstract::$$_element


string $_encoding = 'UTF-8'
'UTF-8'
Details- Type
- string
- Inherited_from
- \Zend_Feed_Element::$$_encoding
- Inherited_from
- \Zend_Feed_Abstract::$$_encoding


string $_entryClassName = 'Zend_Feed_Entry_Atom'
The classname for individual feed elements.
'Zend_Feed_Entry_Atom'
Details- Type
- string


string $_entryElementName = 'entry'
The element name for individual feed elements (Atom <entry> elements).
'entry'
Details- Type
- string


integer $_entryIndex = 0
Current index on the collection of feed entries for the Iterator implementation.
Inherited from: \Zend_Feed_Abstract::$$_entryIndex0
Details- Type
- integer
- Inherited_from
- \Zend_Feed_Abstract::$$_entryIndex


\Zend_Feed_Element $_parentElement =
- Type
- \Zend_Feed_Element
- Inherited_from
- \Zend_Feed_Element::$$_parentElement
- Inherited_from
- \Zend_Feed_Abstract::$$_parentElement
Methods


__call(string $var, mixed $unused) : mixed
Get the value of an element with method syntax.
Inherited from: \Zend_Feed_Element::__call()\Zend_Feed_Abstract::__call()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.
Name | Type | Description |
---|---|---|
$var | string | The element to get the string value of. |
$unused | mixed | This parameter is not used. |
Type | Description |
---|---|
mixed | The node's value, null, or an array of nodes. |


__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.
Name | Type | Description |
---|---|---|
$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. |
Exception | Description |
---|---|
\Zend_Feed_Exception | If loading the feed failed. |


__get(string $var) : mixed
Make accessing some individual elements of the feed easier.
Special accessors 'entry' and 'entries' are provided so that if you wish to iterate over an Atom feed's entries, you can do so using foreach ($feed->entries as $entry) or foreach ($feed->entry as $entry).
Name | Type | Description |
---|---|---|
$var | string | The property to access. |
Type | Description |
---|---|
mixed |


__isset(string $var) : boolean
Map isset calls onto the underlying entry representation.
Inherited from: \Zend_Feed_Element::__isset()\Zend_Feed_Abstract::__isset()Name | Type | Description |
---|---|---|
$var | string |
Type | Description |
---|---|
boolean |


__set(string $var, string $val) : void
Map variable sets onto the underlying entry representation.
Inherited from: \Zend_Feed_Element::__set()\Zend_Feed_Abstract::__set()Name | Type | Description |
---|---|---|
$var | string | The property to change. |
$val | string | The property's new value. |
Exception | Description |
---|---|
\Zend_Feed_Exception |


__toString() : string
Returns the nodeValue of this element when this object is used in a string context.
Inherited from: \Zend_Feed_Element::__toString()\Zend_Feed_Abstract::__toString()Type | Description |
---|---|
string |


__unset(string $var) : void
Remove all children matching $var.
Inherited from: \Zend_Feed_Element::__unset()\Zend_Feed_Abstract::__unset()Name | Type | Description |
---|---|---|
$var | string |


__wakeup() : void
Override Zend_Feed_Abstract to set up the $_element and $_entries aliases.
Exception | Description |
---|---|
\Zend_Feed_Exception |


_buildEntryCache() : void
Cache the individual feed elements so they don't need to be searched for on every operation.
Inherited from: \Zend_Feed_Abstract::_buildEntryCache()

_children(string $var) : array
Finds children with tagnames matching $var
Inherited from: \Zend_Feed_Element::_children()\Zend_Feed_Abstract::_children()Similar to SimpleXML's children() method.
Name | Type | Description |
---|---|---|
$var | string | Tagname to match, can be either namespace:tagName or just tagName. |
Type | Description |
---|---|
array |


_importFeedFromString(string $feed) : string
Protects against XXE attack vectors.
Name | Type | Description |
---|---|---|
$feed | string |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Feed_Exception | on detection of an XXE vector |


_mapFeedEntries(\DOMElement $root, array $array) : void
Generate the entries of the feed when working in write mode
The following nodes are constructed for each feed entry
Name | Type | Description |
---|---|---|
$root | \DOMElement | the root node to use |
$array | array | the data to use |


_mapFeedHeaders(array $array) : \DOMElement
Generate the header of the feed when working in write mode
Name | Type | Description |
---|---|---|
$array | array | the data to use |
Type | Description |
---|---|
\DOMElement | root node |


count() : integer
Get the number of entries in this feed object.
Inherited from: \Zend_Feed_Abstract::count()Type | Description |
---|---|
integer | Entry count. |


ensureAppended() : void
Appends this element to its parent if necessary.
Inherited from: \Zend_Feed_Element::ensureAppended()\Zend_Feed_Abstract::ensureAppended()

getDOM() : \DOMDocument
Get a DOM representation of the element
Inherited from: \Zend_Feed_Element::getDOM()\Zend_Feed_Abstract::getDOM()Returns the underlying DOM object, which can then be manipulated with full DOM methods.
Type | Description |
---|---|
\DOMDocument |


getEncoding() : string
Get encoding
Inherited from: \Zend_Feed_Element::getEncoding()\Zend_Feed_Abstract::getEncoding()Type | Description |
---|---|
string |


key() : mixed
Type | Description |
---|---|
mixed | The current row number (starts at 0), or NULL if no rows |


link(string $rel = null) : mixed
Easy access to tags keyed by "rel" attributes.
If $elt->link() is called with no arguments, we will attempt to return the value of the tag(s) like all other method-syntax attribute access. If an argument is passed to link(), however, then we will return the "href" value of the first tag that has a "rel" attribute matching $rel:
$elt->link(): returns the value of the link tag. $elt->link('self'): returns the href from the first in the entry.
Name | Type | Description |
---|---|---|
$rel | string | The "rel" attribute to look for. |
Type | Description |
---|---|
mixed |


offsetExists(string $offset) : boolean
Required by the ArrayAccess interface.
Inherited from: \Zend_Feed_Element::offsetExists()\Zend_Feed_Abstract::offsetExists()Name | Type | Description |
---|---|---|
$offset | string |
Type | Description |
---|---|
boolean |


offsetGet(string $offset) : string
Required by the ArrayAccess interface.
Inherited from: \Zend_Feed_Element::offsetGet()\Zend_Feed_Abstract::offsetGet()Name | Type | Description |
---|---|---|
$offset | string |
Type | Description |
---|---|
string |


offsetSet(string $offset, string $value) : string
Required by the ArrayAccess interface.
Inherited from: \Zend_Feed_Element::offsetSet()\Zend_Feed_Abstract::offsetSet()Name | Type | Description |
---|---|---|
$offset | string | |
$value | string |
Type | Description |
---|---|
string |


offsetUnset(string $offset) : boolean
Required by the ArrayAccess interface.
Inherited from: \Zend_Feed_Element::offsetUnset()\Zend_Feed_Abstract::offsetUnset()Name | Type | Description |
---|---|---|
$offset | string |
Type | Description |
---|---|
boolean |


saveXml() : string
Override Zend_Feed_Element to allow formated feeds
Returns a string of this element's XML, including the XML prologue.
Type | Description |
---|---|
string |


saveXmlFragment() : string
Get the XML for only this element
Inherited from: \Zend_Feed_Element::saveXmlFragment()\Zend_Feed_Abstract::saveXmlFragment()Returns a string of this element's XML without prologue.
Type | Description |
---|---|
string |


send() : void
Send feed to a http client with the correct header
Exception | Description |
---|---|
\Zend_Feed_Exception | if headers have already been sent |


setDOM(\DOMElement $element) : void
Update the object from a DOM element
Inherited from: \Zend_Feed_Element::setDOM()\Zend_Feed_Abstract::setDOM()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.
Name | Type | Description |
---|---|---|
$element | \DOMElement |


setEncoding(string $value) : \Zend_Feed_Element
Set encoding
Inherited from: \Zend_Feed_Element::setEncoding()\Zend_Feed_Abstract::setEncoding()Name | Type | Description |
---|---|---|
$value | string | Encoding to use |
Type | Description |
---|---|
\Zend_Feed_Element |


setParent(\Zend_Feed_Element $element) : void
Set the parent element of this object to another Zend_Feed_Element.
Inherited from: \Zend_Feed_Element::setParent()\Zend_Feed_Abstract::setParent()Name | Type | Description |
---|---|---|
$element | \Zend_Feed_Element |