[44] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Zend Framework
|
---|
| 5 | *
|
---|
| 6 | * LICENSE
|
---|
| 7 | *
|
---|
| 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.
|
---|
| 15 | *
|
---|
| 16 | * @category Zend
|
---|
| 17 | * @package Zend_Gdata
|
---|
| 18 | * @subpackage Gdata
|
---|
| 19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @see Zend_Gdata_Extension
|
---|
| 25 | */
|
---|
| 26 | require_once 'Zend/Gdata/Extension.php';
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * @see Zend_Gdata_Extension_FeedLink
|
---|
| 30 | */
|
---|
| 31 | require_once 'Zend/Gdata/Extension/FeedLink.php';
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * Represents the gd:comments element
|
---|
| 35 | *
|
---|
| 36 | * @category Zend
|
---|
| 37 | * @package Zend_Gdata
|
---|
| 38 | * @subpackage Gdata
|
---|
| 39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 41 | */
|
---|
| 42 | class Zend_Gdata_Extension_Comments extends Zend_Gdata_Extension
|
---|
| 43 | {
|
---|
| 44 |
|
---|
| 45 | protected $_rootElement = 'comments';
|
---|
| 46 | protected $_rel = null;
|
---|
| 47 | protected $_feedLink = null;
|
---|
| 48 |
|
---|
| 49 | public function __construct($rel = null, $feedLink = null)
|
---|
| 50 | {
|
---|
| 51 | parent::__construct();
|
---|
| 52 | $this->_rel = $rel;
|
---|
| 53 | $this->_feedLink = $feedLink;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 57 | {
|
---|
| 58 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 59 | if ($this->_rel !== null) {
|
---|
| 60 | $element->setAttribute('rel', $this->_rel);
|
---|
| 61 | }
|
---|
| 62 | if ($this->_feedLink !== null) {
|
---|
| 63 | $element->appendChild($this->_feedLink->getDOM($element->ownerDocument));
|
---|
| 64 | }
|
---|
| 65 | return $element;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | protected function takeChildFromDOM($child)
|
---|
| 69 | {
|
---|
| 70 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
| 71 | switch ($absoluteNodeName) {
|
---|
| 72 | case $this->lookupNamespace('gd') . ':' . 'feedLink';
|
---|
| 73 | $feedLink = new Zend_Gdata_Extension_FeedLink();
|
---|
| 74 | $feedLink->transferFromDOM($child);
|
---|
| 75 | $this->_feedLink = $feedLink;
|
---|
| 76 | break;
|
---|
| 77 | default:
|
---|
| 78 | parent::takeChildFromDOM($child);
|
---|
| 79 | break;
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | protected function takeAttributeFromDOM($attribute)
|
---|
| 84 | {
|
---|
| 85 | switch ($attribute->localName) {
|
---|
| 86 | case 'rel':
|
---|
| 87 | $this->_rel = $attribute->nodeValue;
|
---|
| 88 | break;
|
---|
| 89 | default:
|
---|
| 90 | parent::takeAttributeFromDOM($attribute);
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | public function getRel()
|
---|
| 95 | {
|
---|
| 96 | return $this->_rel;
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | public function setRel($value)
|
---|
| 100 | {
|
---|
| 101 | $this->_rel = $value;
|
---|
| 102 | return $this;
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | public function getFeedLink()
|
---|
| 106 | {
|
---|
| 107 | return $this->_feedLink;
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | public function setFeedLink($value)
|
---|
| 111 | {
|
---|
| 112 | $this->_feedLink = $value;
|
---|
| 113 | return $this;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | }
|
---|