/zf/library/Zend/Feed/Writer/Extension/RendererAbstract.php

http://github.com/eryx/php-framework-benchmark · PHP · 180 lines · 55 code · 18 blank · 107 comment · 0 complexity · 23b87bc44628c80ace2500f585776c97 MD5 · raw file

  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 padraic dot brady at yahoo dot com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Feed_Writer
  17. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id: RendererAbstract.php 24437 2011-09-03 19:31:11Z ramon $
  20. */
  21. /**
  22. * @see Zend_Feed_Writer_Extension_RendererInterface
  23. */
  24. require_once 'Zend/Feed/Writer/Extension/RendererInterface.php';
  25. /**
  26. * @category Zend
  27. * @package Zend_Feed_Writer
  28. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. abstract class Zend_Feed_Writer_Extension_RendererAbstract
  32. implements Zend_Feed_Writer_Extension_RendererInterface
  33. {
  34. /**
  35. * @var DOMDocument
  36. */
  37. protected $_dom = null;
  38. /**
  39. * @var mixed
  40. */
  41. protected $_entry = null;
  42. /**
  43. * @var DOMElement
  44. */
  45. protected $_base = null;
  46. /**
  47. * @var mixed
  48. */
  49. protected $_container = null;
  50. /**
  51. * @var string
  52. */
  53. protected $_type = null;
  54. /**
  55. * @var DOMElement
  56. */
  57. protected $_rootElement = null;
  58. /**
  59. * Encoding of all text values
  60. *
  61. * @var string
  62. */
  63. protected $_encoding = 'UTF-8';
  64. /**
  65. * Constructor
  66. *
  67. * @param mixed $container
  68. * @return void
  69. */
  70. public function __construct($container)
  71. {
  72. $this->_container = $container;
  73. }
  74. /**
  75. * Set feed encoding
  76. *
  77. * @param string $enc
  78. * @return Zend_Feed_Writer_Extension_RendererAbstract
  79. */
  80. public function setEncoding($enc)
  81. {
  82. $this->_encoding = $enc;
  83. return $this;
  84. }
  85. /**
  86. * Get feed encoding
  87. *
  88. * @return void
  89. */
  90. public function getEncoding()
  91. {
  92. return $this->_encoding;
  93. }
  94. /**
  95. * Set DOMDocument and DOMElement on which to operate
  96. *
  97. * @param DOMDocument $dom
  98. * @param DOMElement $base
  99. * @return Zend_Feed_Writer_Extension_RendererAbstract
  100. */
  101. public function setDomDocument(DOMDocument $dom, DOMElement $base)
  102. {
  103. $this->_dom = $dom;
  104. $this->_base = $base;
  105. return $this;
  106. }
  107. /**
  108. * Get data container being rendered
  109. *
  110. * @return mixed
  111. */
  112. public function getDataContainer()
  113. {
  114. return $this->_container;
  115. }
  116. /**
  117. * Set feed type
  118. *
  119. * @param string $type
  120. * @return Zend_Feed_Writer_Extension_RendererAbstract
  121. */
  122. public function setType($type)
  123. {
  124. $this->_type = $type;
  125. return $this;
  126. }
  127. /**
  128. * Get feedtype
  129. *
  130. * @return string
  131. */
  132. public function getType()
  133. {
  134. return $this->_type;
  135. }
  136. /**
  137. * Set root element of document
  138. *
  139. * @param DOMElement $root
  140. * @return Zend_Feed_Writer_Extension_RendererAbstract
  141. */
  142. public function setRootElement(DOMElement $root)
  143. {
  144. $this->_rootElement = $root;
  145. return $this;
  146. }
  147. /**
  148. * Get root element
  149. *
  150. * @return DOMElement
  151. */
  152. public function getRootElement()
  153. {
  154. return $this->_rootElement;
  155. }
  156. /**
  157. * Append namespaces to feed
  158. *
  159. * @return void
  160. */
  161. abstract protected function _appendNamespaces();
  162. }