/library/Zend/Feed/Reader/Extension/Thread/Entry.php

https://bitbucket.org/hamidrezas/melobit · PHP · 91 lines · 29 code · 10 blank · 52 comment · 2 complexity · 317de492c31a5c80ba6422266b72dde9 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 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-2012 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 24594 2012-01-05 21:27:01Z matthew $
  20. */
  21. /**
  22. * @see Zend_Feed_Reader_Extension_EntryAbstract
  23. */
  24. require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
  25. /**
  26. * @category Zend
  27. * @package Zend_Feed_Reader
  28. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. class Zend_Feed_Reader_Extension_Thread_Entry
  32. extends Zend_Feed_Reader_Extension_EntryAbstract
  33. {
  34. /**
  35. * Get the "in-reply-to" value
  36. *
  37. * @return string
  38. */
  39. public function getInReplyTo()
  40. {
  41. // TODO: to be implemented
  42. }
  43. // TODO: Implement "replies" and "updated" constructs from standard
  44. /**
  45. * Get the total number of threaded responses (i.e comments)
  46. *
  47. * @return int|null
  48. */
  49. public function getCommentCount()
  50. {
  51. return $this->_getData('total');
  52. }
  53. /**
  54. * Get the entry data specified by name
  55. *
  56. * @param string $name
  57. * @param string $type
  58. * @return mixed|null
  59. */
  60. protected function _getData($name)
  61. {
  62. if (array_key_exists($name, $this->_data)) {
  63. return $this->_data[$name];
  64. }
  65. $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')');
  66. if (!$data) {
  67. $data = null;
  68. }
  69. $this->_data[$name] = $data;
  70. return $data;
  71. }
  72. /**
  73. * Register Atom Thread Extension 1.0 namespace
  74. *
  75. * @return void
  76. */
  77. protected function _registerNamespaces()
  78. {
  79. $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0');
  80. }
  81. }