web/lib/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    12  * obtain it through the world-wide-web, please send an email
    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.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Feed_Writer
    16  * @package    Zend_Feed_Writer
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @version    $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $
    19  * @version    $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
    20  */
    20  */
    21  
    21 
    22 /**
    22 /**
    23  * @see Zend_Feed_Writer_Extension_RendererAbstract
    23  * @see Zend_Feed_Writer_Extension_RendererAbstract
    24  */
    24  */
    25 require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
    25 require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
    26  
    26 
    27 /**
    27 /**
    28  * @category   Zend
    28  * @category   Zend
    29  * @package    Zend_Feed_Writer
    29  * @package    Zend_Feed_Writer
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    30  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    32  */
    32  */
    33 class Zend_Feed_Writer_Extension_Atom_Renderer_Feed
    33 class Zend_Feed_Writer_Extension_Atom_Renderer_Feed
    34     extends Zend_Feed_Writer_Extension_RendererAbstract
    34     extends Zend_Feed_Writer_Extension_RendererAbstract
    35 {
    35 {
    40      * until an element which requires it is actually appended.
    40      * until an element which requires it is actually appended.
    41      *
    41      *
    42      * @var bool
    42      * @var bool
    43      */
    43      */
    44     protected $_called = false;
    44     protected $_called = false;
    45     
    45 
    46     /**
    46     /**
    47      * Render feed
    47      * Render feed
    48      * 
    48      *
    49      * @return void
    49      * @return void
    50      */
    50      */
    51     public function render()
    51     public function render()
    52     {
    52     {
    53         /**
    53         /**
    61         $this->_setHubs($this->_dom, $this->_base);
    61         $this->_setHubs($this->_dom, $this->_base);
    62         if ($this->_called) {
    62         if ($this->_called) {
    63             $this->_appendNamespaces();
    63             $this->_appendNamespaces();
    64         }
    64         }
    65     }
    65     }
    66     
    66 
    67     /**
    67     /**
    68      * Append namespaces to root element of feed
    68      * Append namespaces to root element of feed
    69      * 
    69      *
    70      * @return void
    70      * @return void
    71      */
    71      */
    72     protected function _appendNamespaces()
    72     protected function _appendNamespaces()
    73     {
    73     {
    74         $this->getRootElement()->setAttribute('xmlns:atom',
    74         $this->getRootElement()->setAttribute('xmlns:atom',
    75             'http://www.w3.org/2005/Atom');  
    75             'http://www.w3.org/2005/Atom');
    76     }
    76     }
    77 
    77 
    78     /**
    78     /**
    79      * Set feed link elements
    79      * Set feed link elements
    80      * 
    80      *
    81      * @param  DOMDocument $dom 
    81      * @param  DOMDocument $dom
    82      * @param  DOMElement $root 
    82      * @param  DOMElement $root
    83      * @return void
    83      * @return void
    84      */
    84      */
    85     protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
    85     protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
    86     {
    86     {
    87         $flinks = $this->getDataContainer()->getFeedLinks();
    87         $flinks = $this->getDataContainer()->getFeedLinks();
    96             $flink->setAttribute('type', $mime);
    96             $flink->setAttribute('type', $mime);
    97             $flink->setAttribute('href', $href);
    97             $flink->setAttribute('href', $href);
    98         }
    98         }
    99         $this->_called = true;
    99         $this->_called = true;
   100     }
   100     }
   101     
   101 
   102     /**
   102     /**
   103      * Set PuSH hubs
   103      * Set PuSH hubs
   104      * 
   104      *
   105      * @param  DOMDocument $dom 
   105      * @param  DOMDocument $dom
   106      * @param  DOMElement $root 
   106      * @param  DOMElement $root
   107      * @return void
   107      * @return void
   108      */
   108      */
   109     protected function _setHubs(DOMDocument $dom, DOMElement $root)
   109     protected function _setHubs(DOMDocument $dom, DOMElement $root)
   110     {
   110     {
   111         $hubs = $this->getDataContainer()->getHubs();
   111         $hubs = $this->getDataContainer()->getHubs();