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_Entry 0031 */ 0032 // require_once 'Zend/Gdata/Entry.php'; 0033 0034 /** 0035 * Represents the gd:entryLink 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_EntryLink extends Zend_Gdata_Extension 0044 { 0045 0046 protected $_rootElement = 'entryLink'; 0047 protected $_href = null; 0048 protected $_readOnly = null; 0049 protected $_rel = null; 0050 protected $_entry = null; 0051 0052 public function __construct($href = null, $rel = null, 0053 $readOnly = null, $entry = null) 0054 { 0055 parent::__construct(); 0056 $this->_href = $href; 0057 $this->_readOnly = $readOnly; 0058 $this->_rel = $rel; 0059 $this->_entry = $entry; 0060 } 0061 0062 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0063 { 0064 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0065 if ($this->_href !== null) { 0066 $element->setAttribute('href', $this->_href); 0067 } 0068 if ($this->_readOnly !== null) { 0069 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false")); 0070 } 0071 if ($this->_rel !== null) { 0072 $element->setAttribute('rel', $this->_rel); 0073 } 0074 if ($this->_entry !== null) { 0075 $element->appendChild($this->_entry->getDOM($element->ownerDocument)); 0076 } 0077 return $element; 0078 } 0079 0080 protected function takeChildFromDOM($child) 0081 { 0082 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 0083 switch ($absoluteNodeName) { 0084 case $this->lookupNamespace('atom') . ':' . 'entry'; 0085 $entry = new Zend_Gdata_Entry(); 0086 $entry->transferFromDOM($child); 0087 $this->_entry = $entry; 0088 break; 0089 default: 0090 parent::takeChildFromDOM($child); 0091 break; 0092 } 0093 } 0094 0095 protected function takeAttributeFromDOM($attribute) 0096 { 0097 switch ($attribute->localName) { 0098 case 'href': 0099 $this->_href = $attribute->nodeValue; 0100 break; 0101 case 'readOnly': 0102 if ($attribute->nodeValue == "true") { 0103 $this->_readOnly = true; 0104 } 0105 else if ($attribute->nodeValue == "false") { 0106 $this->_readOnly = false; 0107 } 0108 else { 0109 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); 0110 } 0111 break; 0112 case 'rel': 0113 $this->_rel = $attribute->nodeValue; 0114 break; 0115 default: 0116 parent::takeAttributeFromDOM($attribute); 0117 } 0118 } 0119 0120 /** 0121 * @return string 0122 */ 0123 public function getHref() 0124 { 0125 return $this->_href; 0126 } 0127 0128 public function setHref($value) 0129 { 0130 $this->_href = $value; 0131 return $this; 0132 } 0133 0134 public function getReadOnly() 0135 { 0136 return $this->_readOnly; 0137 } 0138 0139 public function setReadOnly($value) 0140 { 0141 $this->_readOnly = $value; 0142 return $this; 0143 } 0144 0145 public function getRel() 0146 { 0147 return $this->_rel; 0148 } 0149 0150 public function setRel($value) 0151 { 0152 $this->_rel = $value; 0153 return $this; 0154 } 0155 0156 public function getEntry() 0157 { 0158 return $this->_entry; 0159 } 0160 0161 public function setEntry($value) 0162 { 0163 $this->_entry = $value; 0164 return $this; 0165 } 0166 0167 }