web/lib/Zend/Feed/Reader/Entry/Rss.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_Reader
    16  * @package    Zend_Feed_Reader
    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: Rss.php 22300 2010-05-26 10:13:34Z padraic $
    19  * @version    $Id: Rss.php 24593 2012-01-05 20:35:02Z matthew $
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @see Zend_Feed_Reader
    23  * @see Zend_Feed_Reader
    24  */
    24  */
    75 require_once 'Zend/Feed/Reader/Collection/Category.php';
    75 require_once 'Zend/Feed/Reader/Collection/Category.php';
    76 
    76 
    77 /**
    77 /**
    78  * @category   Zend
    78  * @category   Zend
    79  * @package    Zend_Feed_Reader
    79  * @package    Zend_Feed_Reader
    80  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    80  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    81  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    81  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    82  */
    82  */
    83 class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface
    83 class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface
    84 {
    84 {
    85 
    85 
   157     public function getAuthors()
   157     public function getAuthors()
   158     {
   158     {
   159         if (array_key_exists('authors', $this->_data)) {
   159         if (array_key_exists('authors', $this->_data)) {
   160             return $this->_data['authors'];
   160             return $this->_data['authors'];
   161         }
   161         }
   162         
   162 
   163         $authors = array();
   163         $authors = array();
   164         $authors_dc = $this->getExtension('DublinCore')->getAuthors();
   164         $authors_dc = $this->getExtension('DublinCore')->getAuthors();
   165         if (!empty($authors_dc)) {
   165         if (!empty($authors_dc)) {
   166             foreach ($authors_dc as $author) {
   166             foreach ($authors_dc as $author) {
   167                 $authors[] = array(
   167                 $authors[] = array(
   168                     'name' => $author['name']
   168                     'name' => $author['name']
   169                 );
   169                 );
   170             }
   170             }
   171         }
   171         }
   172         
   172 
   173         if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
   173         if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
   174         && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) {
   174         && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) {
   175             $list = $this->_xpath->query($this->_xpathQueryRss . '//author');
   175             $list = $this->_xpath->query($this->_xpathQueryRss . '//author');
   176         } else {
   176         } else {
   177             $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author');
   177             $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author');
   187                     $data['email'] = trim($matches[0]);
   187                     $data['email'] = trim($matches[0]);
   188                     if (preg_match("/\((.*)\)$/", $string, $matches)) {
   188                     if (preg_match("/\((.*)\)$/", $string, $matches)) {
   189                         $data['name'] = $matches[1];
   189                         $data['name'] = $matches[1];
   190                     }
   190                     }
   191                     $authors[] = $data;
   191                     $authors[] = $data;
   192                 } 
   192                 }
   193             }
   193             }
   194         }
   194         }
   195 
   195 
   196         if (count($authors) == 0) {
   196         if (count($authors) == 0) {
   197             $authors = $this->getExtension('Atom')->getAuthors();
   197             $authors = $this->getExtension('Atom')->getAuthors();
   470 
   470 
   471         $this->_data['links'] = $links;
   471         $this->_data['links'] = $links;
   472 
   472 
   473         return $this->_data['links'];
   473         return $this->_data['links'];
   474     }
   474     }
   475     
   475 
   476     /**
   476     /**
   477      * Get all categories
   477      * Get all categories
   478      *
   478      *
   479      * @return Zend_Feed_Reader_Collection_Category
   479      * @return Zend_Feed_Reader_Collection_Category
   480      */
   480      */
   501                 );
   501                 );
   502             }
   502             }
   503         } else {
   503         } else {
   504             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
   504             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
   505         }
   505         }
   506         
   506 
   507         if (count($categoryCollection) == 0) {
   507         if (count($categoryCollection) == 0) {
   508             $categoryCollection = $this->getExtension('Atom')->getCategories();
   508             $categoryCollection = $this->getExtension('Atom')->getCategories();
   509         }
   509         }
   510 
   510 
   511         $this->_data['categories'] = $categoryCollection;
   511         $this->_data['categories'] = $categoryCollection;