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_Feed
32 require_once 'Zend/Gdata/Feed.php';
35 * Represents the gd:feedLink 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_FeedLink extends Zend_Gdata_Extension
46 protected $_rootElement = 'feedLink';
47 protected $_countHint = null;
48 protected $_href = null;
49 protected $_readOnly = null;
50 protected $_rel = null;
51 protected $_feed = null;
53 public function __construct($href = null, $rel = null,
54 $countHint = null, $readOnly = null, $feed = null)
56 parent::__construct();
57 $this->_countHint = $countHint;
59 $this->_readOnly = $readOnly;
64 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
66 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
67 if ($this->_countHint !== null) {
68 $element->setAttribute('countHint', $this->_countHint);
70 if ($this->_href !== null) {
71 $element->setAttribute('href', $this->_href);
73 if ($this->_readOnly !== null) {
74 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
76 if ($this->_rel !== null) {
77 $element->setAttribute('rel', $this->_rel);
79 if ($this->_feed !== null) {
80 $element->appendChild($this->_feed->getDOM($element->ownerDocument));
85 protected function takeChildFromDOM($child)
87 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
88 switch ($absoluteNodeName) {
89 case $this->lookupNamespace('atom') . ':' . 'feed';
90 $feed = new Zend_Gdata_Feed();
91 $feed->transferFromDOM($child);
95 parent::takeChildFromDOM($child);
100 protected function takeAttributeFromDOM($attribute)
102 switch ($attribute->localName) {
104 $this->_countHint = $attribute->nodeValue;
107 $this->_href = $attribute->nodeValue;
110 if ($attribute->nodeValue == "true") {
111 $this->_readOnly = true;
113 else if ($attribute->nodeValue == "false") {
114 $this->_readOnly = false;
117 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
121 $this->_rel = $attribute->nodeValue;
124 parent::takeAttributeFromDOM($attribute);
131 public function getHref()
136 public function setHref($value)
138 $this->_href = $value;
142 public function getReadOnly()
144 return $this->_readOnly;
147 public function setReadOnly($value)
149 $this->_readOnly = $value;
153 public function getRel()
158 public function setRel($value)
160 $this->_rel = $value;
164 public function getFeed()
169 public function setFeed($value)
171 $this->_feed = $value;