8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * @see Zend_Gdata_Extension_FeedLink
32 require_once 'Zend/Gdata/Extension/FeedLink.php';
35 * Represents the gd:comments element
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Extension_Comments extends Zend_Gdata_Extension
46 protected $_rootElement = 'comments';
47 protected $_rel = null;
48 protected $_feedLink = null;
50 public function __construct($rel = null, $feedLink = null)
52 parent::__construct();
54 $this->_feedLink = $feedLink;
57 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
59 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
60 if ($this->_rel !== null) {
61 $element->setAttribute('rel', $this->_rel);
63 if ($this->_feedLink !== null) {
64 $element->appendChild($this->_feedLink->getDOM($element->ownerDocument));
69 protected function takeChildFromDOM($child)
71 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
72 switch ($absoluteNodeName) {
73 case $this->lookupNamespace('gd') . ':' . 'feedLink';
74 $feedLink = new Zend_Gdata_Extension_FeedLink();
75 $feedLink->transferFromDOM($child);
76 $this->_feedLink = $feedLink;
79 parent::takeChildFromDOM($child);
84 protected function takeAttributeFromDOM($attribute)
86 switch ($attribute->localName) {
88 $this->_rel = $attribute->nodeValue;
91 parent::takeAttributeFromDOM($attribute);
95 public function getRel()
100 public function setRel($value)
102 $this->_rel = $value;
106 public function getFeedLink()
108 return $this->_feedLink;
111 public function setFeedLink($value)
113 $this->_feedLink = $value;