示例#1
0
 /**
  * Simple utility function which imports any feed URL and
  * determines the existence of Hub Server endpoints. This works
  * best if directly given an instance of Zend_Feed_Reader_Atom|Rss
  * to leverage off.
  *
  * @param  Zend_Feed_Reader_FeedAbstract|\Zend\Feed\AbstractFeed|string $source
  * @return array
  */
 public static function detectHubs($source)
 {
     if (is_string($source)) {
         $feed = Reader\Reader::import($source);
     } elseif (is_object($source) && $source instanceof Reader\FeedAbstract) {
         $feed = $source;
     } elseif (is_object($source) && $source instanceof \Zend\Feed\AbstractFeed) {
         $feed = Reader\Reader::importFeed($source);
     } else {
         require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
         throw new Exception('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' . ' Zend_Feed_Reader_FeedAbstract or Zend_Feed_Abstract');
     }
     return $feed->getHubs();
 }