File indexing completed on 2025-03-02 05:29:27
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Gdata 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_Extension 0026 */ 0027 // require_once 'Zend/Gdata/Extension.php'; 0028 0029 /** 0030 * @see Zend_Gdata_Feed 0031 */ 0032 // require_once 'Zend/Gdata/Feed.php'; 0033 0034 /** 0035 * Represents the gd:feedLink element 0036 * 0037 * @category Zend 0038 * @package Zend_Gdata 0039 * @subpackage Gdata 0040 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0041 * @license http://framework.zend.com/license/new-bsd New BSD License 0042 */ 0043 class Zend_Gdata_Extension_FeedLink extends Zend_Gdata_Extension 0044 { 0045 0046 protected $_rootElement = 'feedLink'; 0047 protected $_countHint = null; 0048 protected $_href = null; 0049 protected $_readOnly = null; 0050 protected $_rel = null; 0051 protected $_feed = null; 0052 0053 public function __construct($href = null, $rel = null, 0054 $countHint = null, $readOnly = null, $feed = null) 0055 { 0056 parent::__construct(); 0057 $this->_countHint = $countHint; 0058 $this->_href = $href; 0059 $this->_readOnly = $readOnly; 0060 $this->_rel = $rel; 0061 $this->_feed = $feed; 0062 } 0063 0064 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0065 { 0066 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0067 if ($this->_countHint !== null) { 0068 $element->setAttribute('countHint', $this->_countHint); 0069 } 0070 if ($this->_href !== null) { 0071 $element->setAttribute('href', $this->_href); 0072 } 0073 if ($this->_readOnly !== null) { 0074 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false")); 0075 } 0076 if ($this->_rel !== null) { 0077 $element->setAttribute('rel', $this->_rel); 0078 } 0079 if ($this->_feed !== null) { 0080 $element->appendChild($this->_feed->getDOM($element->ownerDocument)); 0081 } 0082 return $element; 0083 } 0084 0085 protected function takeChildFromDOM($child) 0086 { 0087 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 0088 switch ($absoluteNodeName) { 0089 case $this->lookupNamespace('atom') . ':' . 'feed'; 0090 $feed = new Zend_Gdata_Feed(); 0091 $feed->transferFromDOM($child); 0092 $this->_feed = $feed; 0093 break; 0094 default: 0095 parent::takeChildFromDOM($child); 0096 break; 0097 } 0098 } 0099 0100 protected function takeAttributeFromDOM($attribute) 0101 { 0102 switch ($attribute->localName) { 0103 case 'countHint': 0104 $this->_countHint = $attribute->nodeValue; 0105 break; 0106 case 'href': 0107 $this->_href = $attribute->nodeValue; 0108 break; 0109 case 'readOnly': 0110 if ($attribute->nodeValue == "true") { 0111 $this->_readOnly = true; 0112 } 0113 else if ($attribute->nodeValue == "false") { 0114 $this->_readOnly = false; 0115 } 0116 else { 0117 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); 0118 } 0119 break; 0120 case 'rel': 0121 $this->_rel = $attribute->nodeValue; 0122 break; 0123 default: 0124 parent::takeAttributeFromDOM($attribute); 0125 } 0126 } 0127 0128 /** 0129 * @return string 0130 */ 0131 public function getHref() 0132 { 0133 return $this->_href; 0134 } 0135 0136 public function setHref($value) 0137 { 0138 $this->_href = $value; 0139 return $this; 0140 } 0141 0142 public function getReadOnly() 0143 { 0144 return $this->_readOnly; 0145 } 0146 0147 public function setReadOnly($value) 0148 { 0149 $this->_readOnly = $value; 0150 return $this; 0151 } 0152 0153 public function getRel() 0154 { 0155 return $this->_rel; 0156 } 0157 0158 public function setRel($value) 0159 { 0160 $this->_rel = $value; 0161 return $this; 0162 } 0163 0164 public function getFeed() 0165 { 0166 return $this->_feed; 0167 } 0168 0169 public function setFeed($value) 0170 { 0171 $this->_feed = $value; 0172 return $this; 0173 } 0174 0175 }