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_Extension_EntryLink 0031 */ 0032 // require_once 'Zend/Gdata/Extension/EntryLink.php'; 0033 0034 /** 0035 * Data model class to represent a location (gd:where 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_Where extends Zend_Gdata_Extension 0044 { 0045 0046 protected $_rootElement = 'where'; 0047 protected $_label = null; 0048 protected $_rel = null; 0049 protected $_valueString = null; 0050 protected $_entryLink = null; 0051 0052 public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null) 0053 { 0054 parent::__construct(); 0055 $this->_valueString = $valueString; 0056 $this->_label = $label; 0057 $this->_rel = $rel; 0058 $this->_entryLink = $entryLink; 0059 } 0060 0061 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0062 { 0063 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0064 if ($this->_label !== null) { 0065 $element->setAttribute('label', $this->_label); 0066 } 0067 if ($this->_rel !== null) { 0068 $element->setAttribute('rel', $this->_rel); 0069 } 0070 if ($this->_valueString !== null) { 0071 $element->setAttribute('valueString', $this->_valueString); 0072 } 0073 if ($this->entryLink !== null) { 0074 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); 0075 } 0076 return $element; 0077 } 0078 0079 protected function takeAttributeFromDOM($attribute) 0080 { 0081 switch ($attribute->localName) { 0082 case 'label': 0083 $this->_label = $attribute->nodeValue; 0084 break; 0085 case 'rel': 0086 $this->_rel = $attribute->nodeValue; 0087 break; 0088 case 'valueString': 0089 $this->_valueString = $attribute->nodeValue; 0090 break; 0091 default: 0092 parent::takeAttributeFromDOM($attribute); 0093 } 0094 } 0095 0096 /** 0097 * Creates individual Entry objects of the appropriate type and 0098 * stores them in the $_entry array based upon DOM data. 0099 * 0100 * @param DOMNode $child The DOMNode to process 0101 */ 0102 protected function takeChildFromDOM($child) 0103 { 0104 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 0105 switch ($absoluteNodeName) { 0106 case $this->lookupNamespace('gd') . ':' . 'entryLink': 0107 $entryLink = new Zend_Gdata_Extension_EntryLink(); 0108 $entryLink->transferFromDOM($child); 0109 $this->_entryLink = $entryLink; 0110 break; 0111 default: 0112 parent::takeChildFromDOM($child); 0113 break; 0114 } 0115 } 0116 0117 public function __toString() 0118 { 0119 if ($this->_valueString != null) { 0120 return $this->_valueString; 0121 } 0122 else { 0123 return parent::__toString(); 0124 } 0125 } 0126 0127 public function getLabel() 0128 { 0129 return $this->_label; 0130 } 0131 0132 public function setLabel($value) 0133 { 0134 $this->_label = $value; 0135 return $this; 0136 } 0137 0138 public function getRel() 0139 { 0140 return $this->_rel; 0141 } 0142 0143 public function setRel($value) 0144 { 0145 $this->_rel = $value; 0146 return $this; 0147 } 0148 0149 public function getValueString() 0150 { 0151 return $this->_valueString; 0152 } 0153 0154 public function setValueString($value) 0155 { 0156 $this->_valueString = $value; 0157 return $this; 0158 } 0159 0160 public function getEntryLink() 0161 { 0162 return $this->_entryLink; 0163 } 0164 0165 public function setEntryLink($value) 0166 { 0167 $this->_entryLink = $value; 0168 return $this; 0169 } 0170 0171 }