web/lib/Zend/Feed/Reader/Extension/Thread/Entry.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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_Feed_Reader
       
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  */
       
    21 
       
    22 /**
       
    23  * @see Zend_Feed_Reader_Extension_EntryAbstract
       
    24  */
       
    25 require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
       
    26 
       
    27 /**
       
    28  * @category   Zend
       
    29  * @package    Zend_Feed_Reader
       
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    32  */
       
    33 class Zend_Feed_Reader_Extension_Thread_Entry
       
    34     extends Zend_Feed_Reader_Extension_EntryAbstract
       
    35 {
       
    36     /**
       
    37      * Get the "in-reply-to" value
       
    38      *
       
    39      * @return string
       
    40      */
       
    41     public function getInReplyTo()
       
    42     {
       
    43         // TODO: to be implemented
       
    44     }
       
    45 
       
    46     // TODO: Implement "replies" and "updated" constructs from standard
       
    47 
       
    48     /**
       
    49      * Get the total number of threaded responses (i.e comments)
       
    50      *
       
    51      * @return int|null
       
    52      */
       
    53     public function getCommentCount()
       
    54     {
       
    55         return $this->_getData('total');
       
    56     }
       
    57 
       
    58     /**
       
    59      * Get the entry data specified by name
       
    60      *
       
    61      * @param  string $name
       
    62      * @param  string $type
       
    63      * @return mixed|null
       
    64      */
       
    65     protected function _getData($name)
       
    66     {
       
    67         if (array_key_exists($name, $this->_data)) {
       
    68             return $this->_data[$name];
       
    69         }
       
    70 
       
    71         $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')');
       
    72 
       
    73         if (!$data) {
       
    74             $data = null;
       
    75         }
       
    76 
       
    77         $this->_data[$name] = $data;
       
    78 
       
    79         return $data;
       
    80     }
       
    81 
       
    82     /**
       
    83      * Register Atom Thread Extension 1.0 namespace
       
    84      *
       
    85      * @return void
       
    86      */
       
    87     protected function _registerNamespaces()
       
    88     {
       
    89         $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
       
    90     }
       
    91 }