File indexing completed on 2024-06-16 05:30:07

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_FeedLink
0031  */
0032 // require_once 'Zend/Gdata/Extension/FeedLink.php';
0033 
0034 /**
0035  * Represents the gd:comments 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_Comments extends Zend_Gdata_Extension
0044 {
0045 
0046     protected $_rootElement = 'comments';
0047     protected $_rel = null;
0048     protected $_feedLink = null;
0049 
0050     public function __construct($rel = null, $feedLink = null)
0051     {
0052         parent::__construct();
0053         $this->_rel = $rel;
0054         $this->_feedLink = $feedLink;
0055     }
0056 
0057     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0058     {
0059         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0060         if ($this->_rel !== null) {
0061             $element->setAttribute('rel', $this->_rel);
0062         }
0063         if ($this->_feedLink !== null) {
0064             $element->appendChild($this->_feedLink->getDOM($element->ownerDocument));
0065         }
0066         return $element;
0067     }
0068 
0069     protected function takeChildFromDOM($child)
0070     {
0071         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0072         switch ($absoluteNodeName) {
0073             case $this->lookupNamespace('gd') . ':' . 'feedLink';
0074                 $feedLink = new Zend_Gdata_Extension_FeedLink();
0075                 $feedLink->transferFromDOM($child);
0076                 $this->_feedLink = $feedLink;
0077                 break;
0078             default:
0079                 parent::takeChildFromDOM($child);
0080                 break;
0081         }
0082     }
0083 
0084     protected function takeAttributeFromDOM($attribute)
0085     {
0086         switch ($attribute->localName) {
0087         case 'rel':
0088             $this->_rel = $attribute->nodeValue;
0089             break;
0090         default:
0091             parent::takeAttributeFromDOM($attribute);
0092         }
0093     }
0094 
0095     public function getRel()
0096     {
0097         return $this->_rel;
0098     }
0099 
0100     public function setRel($value)
0101     {
0102         $this->_rel = $value;
0103         return $this;
0104     }
0105 
0106     public function getFeedLink()
0107     {
0108         return $this->_feedLink;
0109     }
0110 
0111     public function setFeedLink($value)
0112     {
0113         $this->_feedLink = $value;
0114         return $this;
0115     }
0116 
0117 }