web/lib/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.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: Entry.php 22662 2010-07-24 17:37:36Z mabe $
    19  * @version    $Id: Entry.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_Threading_Renderer_Entry
    33 class Zend_Feed_Writer_Extension_Threading_Renderer_Entry
    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 entry
    47      * Render entry
    48      * 
    48      *
    49      * @return void
    49      * @return void
    50      */
    50      */
    51     public function render()
    51     public function render()
    52     {
    52     {
    53         if (strtolower($this->getType()) == 'rss') {
    53         if (strtolower($this->getType()) == 'rss') {
    58         $this->_setCommentCount($this->_dom, $this->_base);
    58         $this->_setCommentCount($this->_dom, $this->_base);
    59         if ($this->_called) {
    59         if ($this->_called) {
    60             $this->_appendNamespaces();
    60             $this->_appendNamespaces();
    61         }
    61         }
    62     }
    62     }
    63     
    63 
    64     /**
    64     /**
    65      * Append entry namespaces
    65      * Append entry namespaces
    66      * 
    66      *
    67      * @return void
    67      * @return void
    68      */
    68      */
    69     protected function _appendNamespaces()
    69     protected function _appendNamespaces()
    70     {
    70     {
    71         $this->getRootElement()->setAttribute('xmlns:thr',
    71         $this->getRootElement()->setAttribute('xmlns:thr',
    72             'http://purl.org/syndication/thread/1.0');  
    72             'http://purl.org/syndication/thread/1.0');
    73     }
    73     }
    74     
    74 
    75     /**
    75     /**
    76      * Set comment link
    76      * Set comment link
    77      * 
    77      *
    78      * @param  DOMDocument $dom 
    78      * @param  DOMDocument $dom
    79      * @param  DOMElement $root 
    79      * @param  DOMElement $root
    80      * @return void
    80      * @return void
    81      */
    81      */
    82     protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
    82     protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
    83     {
    83     {
    84         $link = $this->getDataContainer()->getCommentLink();
    84         $link = $this->getDataContainer()->getCommentLink();
    94             $clink->setAttribute('thr:count', $count);
    94             $clink->setAttribute('thr:count', $count);
    95         }
    95         }
    96         $root->appendChild($clink);
    96         $root->appendChild($clink);
    97         $this->_called = true;
    97         $this->_called = true;
    98     }
    98     }
    99     
    99 
   100     /**
   100     /**
   101      * Set comment feed links
   101      * Set comment feed links
   102      * 
   102      *
   103      * @param  DOMDocument $dom 
   103      * @param  DOMDocument $dom
   104      * @param  DOMElement $root 
   104      * @param  DOMElement $root
   105      * @return void
   105      * @return void
   106      */
   106      */
   107     protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root)
   107     protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root)
   108     {
   108     {
   109         $links = $this->getDataContainer()->getCommentFeedLinks();
   109         $links = $this->getDataContainer()->getCommentFeedLinks();
   124         }
   124         }
   125     }
   125     }
   126 
   126 
   127     /**
   127     /**
   128      * Set entry comment count
   128      * Set entry comment count
   129      * 
   129      *
   130      * @param  DOMDocument $dom 
   130      * @param  DOMDocument $dom
   131      * @param  DOMElement $root 
   131      * @param  DOMElement $root
   132      * @return void
   132      * @return void
   133      */
   133      */
   134     protected function _setCommentCount(DOMDocument $dom, DOMElement $root)
   134     protected function _setCommentCount(DOMDocument $dom, DOMElement $root)
   135     {
   135     {
   136         $count = $this->getDataContainer()->getCommentCount();
   136         $count = $this->getDataContainer()->getCommentCount();