Documentation

Horde_Feed_Entry_Atom extends Horde_Feed_Entry_Base

Concrete class for working with Atom entries.

Tags
author

Chuck Hagenbuch chuck@horde.org

category

Horde

copyright

2005-2007 Zend Technologies USA Inc.

copyright

2007-2017 Horde LLC

license

http://www.horde.org/licenses/bsd BSD

Table of Contents

$_emptyXml  : string
The XML string for an "empty" Atom entry.
$_entryElementName  : string
Name of the XML element for Atom entries. Subclasses can override this to something other than "entry" if necessary.
$_httpClient  : Horde_Http_Client
__construct()  : mixed
Handle null or array values for $this->_element by initializing with $this->_emptyXml, and importing the array with Horde_Xml_Element::fromArray() if necessary.
delete()  : mixed
Delete an atom entry.
link()  : mixed
Easy access to <link> tags keyed by "rel" attributes.
save()  : mixed
Save a new or updated Atom entry.

Properties

$_emptyXml

The XML string for an "empty" Atom entry.

protected string $_emptyXml = '<atom:entry/>'

$_entryElementName

Name of the XML element for Atom entries. Subclasses can override this to something other than "entry" if necessary.

protected string $_entryElementName = 'entry'

$_httpClient

protected Horde_Http_Client $_httpClient

Methods

__construct()

Handle null or array values for $this->_element by initializing with $this->_emptyXml, and importing the array with Horde_Xml_Element::fromArray() if necessary.

public __construct([mixed $element = null ][, Horde_Http_Client $httpClient = null ]) : mixed
Parameters
$element : mixed = null
$httpClient : Horde_Http_Client = null
Tags
see
Horde_Xml_Element::__wakeup
see
Horde_Xml_Element::fromArray
Return values
mixed

delete()

Delete an atom entry.

public delete() : mixed

Delete tries to delete this entry from its feed. If the entry does not contain a link rel="edit", we throw an error (either the entry does not yet exist or this is not an editable feed). If we have a link rel="edit", we do the empty-body HTTP DELETE to that URI and check for a response of 2xx. Usually the response would be 204 No Content, but the Atom Publishing Protocol permits it to be 200 OK.

Tags
throws
Horde_Feed_Exception

If an error occurs, an Horde_Feed_Exception will be thrown.

Return values
mixed

Easy access to <link> tags keyed by "rel" attributes.

public link([string $rel = null ]) : mixed
Parameters
$rel : string = null

The "rel" attribute to look for.

Tags
TODO

rationalize this with other __get/__call access

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.

Return values
mixed

save()

Save a new or updated Atom entry.

public save([string $postUri = null ][, array<string|int, mixed> $headers = array() ]) : mixed

Save is used to either create new entries or to save changes to existing ones. If we have a link rel="edit", we are changing an existing entry. In this case we re-serialize the entry and PUT it to the edit URI, checking for a 200 OK result.

For posting new entries, you must specify the $postUri parameter to save() to tell the object where to post itself. We use $postUri and POST the serialized entry there, checking for a 201 Created response. If the insert is successful, we then parse the response from the POST to get any values that the server has generated: an id, an updated time, and its new link rel="edit".

Parameters
$postUri : string = null

Location to POST for creating new entries.

$headers : array<string|int, mixed> = array()

Additional headers to transmit while posting.

Tags
throws
Horde_Feed_Exception

If an error occurs, a Horde_Feed_Exception will be thrown.

Return values
mixed

Search results