1: <?php
2: /**
3: * Portions Copyright 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
4: * Copyright 2007-2012 Horde LLC (http://www.horde.org/)
5: *
6: * @category Horde
7: * @package Feed
8: */
9:
10: /**
11: * Horde_Feed_Entry_Base represents a single entry in an Atom or RSS
12: * feed.
13: *
14: * @category Horde
15: * @package Feed
16: */
17: abstract class Horde_Feed_Entry_Base extends Horde_Xml_Element
18: {
19: /**
20: * @var Horde_Http_Client
21: */
22: protected $_httpClient;
23:
24: /**
25: * Handle null or array values for $this->_element by initializing
26: * with $this->_emptyXml, and importing the array with
27: * Horde_Xml_Element::fromArray() if necessary.
28: *
29: * @see Horde_Xml_Element::__wakeup
30: * @see Horde_Xml_Element::fromArray
31: */
32: public function __construct($element = null, Horde_Http_Client $httpClient = null)
33: {
34: $this->_element = $element;
35:
36: if (is_null($httpClient)) {
37: $httpClient = new Horde_Http_Client();
38: }
39: $this->_httpClient = $httpClient;
40:
41: // If we've been passed an array, we'll store it for importing
42: // after initializing with the default "empty" feed XML.
43: $importArray = null;
44: if (is_null($this->_element)) {
45: $this->_element = $this->_emptyXml;
46: } elseif (is_array($this->_element)) {
47: $importArray = $this->_element;
48: $this->_element = $this->_emptyXml;
49: }
50:
51: $this->__wakeup();
52:
53: if (!is_null($importArray)) {
54: $this->fromArray($importArray);
55: }
56: }
57: }
58: