File indexing completed on 2025-01-19 05:21:05

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Feed_Reader
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /**
0023  * @see Zend_Feed_Reader_Extension_EntryAbstract
0024  */
0025 // require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
0026 
0027 /**
0028  * @category   Zend
0029  * @package    Zend_Feed_Reader
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 class Zend_Feed_Reader_Extension_Thread_Entry
0034     extends Zend_Feed_Reader_Extension_EntryAbstract
0035 {
0036     /**
0037      * Get the "in-reply-to" value
0038      *
0039      * @return string
0040      */
0041     public function getInReplyTo()
0042     {
0043         // TODO: to be implemented
0044     }
0045 
0046     // TODO: Implement "replies" and "updated" constructs from standard
0047 
0048     /**
0049      * Get the total number of threaded responses (i.e comments)
0050      *
0051      * @return int|null
0052      */
0053     public function getCommentCount()
0054     {
0055         return $this->_getData('total');
0056     }
0057 
0058     /**
0059      * Get the entry data specified by name
0060      *
0061      * @param  string $name
0062      * @param  string $type
0063      * @return mixed|null
0064      */
0065     protected function _getData($name)
0066     {
0067         if (array_key_exists($name, $this->_data)) {
0068             return $this->_data[$name];
0069         }
0070 
0071         $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')');
0072 
0073         if (!$data) {
0074             $data = null;
0075         }
0076 
0077         $this->_data[$name] = $data;
0078 
0079         return $data;
0080     }
0081 
0082     /**
0083      * Register Atom Thread Extension 1.0 namespace
0084      *
0085      * @return void
0086      */
0087     protected function _registerNamespaces()
0088     {
0089         $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
0090     }
0091 }