Content.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage App
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Gdata_App_Extension_Text
  24. */
  25. require_once 'Zend/Gdata/App/Extension/Text.php';
  26. /**
  27. * Represents the atom:content element
  28. *
  29. * @category Zend
  30. * @package Zend_Gdata
  31. * @subpackage App
  32. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
  36. {
  37. protected $_rootElement = 'content';
  38. protected $_src = null;
  39. public function __construct($text = null, $type = 'text', $src = null)
  40. {
  41. parent::__construct($text, $type);
  42. $this->_src = $src;
  43. }
  44. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  45. {
  46. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  47. if ($this->_src !== null) {
  48. $element->setAttribute('src', $this->_src);
  49. }
  50. return $element;
  51. }
  52. protected function takeAttributeFromDOM($attribute)
  53. {
  54. switch ($attribute->localName) {
  55. case 'src':
  56. $this->_src = $attribute->nodeValue;
  57. break;
  58. default:
  59. parent::takeAttributeFromDOM($attribute);
  60. }
  61. }
  62. /**
  63. * @return string
  64. */
  65. public function getSrc()
  66. {
  67. return $this->_src;
  68. }
  69. /**
  70. * @param string $value
  71. * @return Zend_Gdata_App_Entry Provides a fluent interface
  72. */
  73. public function setSrc($value)
  74. {
  75. $this->_src = $value;
  76. return $this;
  77. }
  78. }