本文整理汇总了PHP中Zend_Feed::findFeeds方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed::findFeeds方法的具体用法?PHP Zend_Feed::findFeeds怎么用?PHP Zend_Feed::findFeeds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed
的用法示例。
在下文中一共展示了Zend_Feed::findFeeds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importData
public function importData()
{
$url = $this->getProperty('url');
try {
$feeds = Zend_Feed::findFeeds($url);
} catch (Zend_Feed_Exception $e) {
return 0;
}
if (!$feeds) {
try {
$items = Zend_Feed::import($url);
} catch (Zend_Feed_Exception $e) {
return 0;
}
$feed_url = $url;
} else {
$feeds_uri = array_keys($feeds);
$feed_url = $feeds_uri[0];
$items = $feeds[$feed_url];
}
$title = $items->title();
$this->setProperty('feed_title', $title);
$this->setProperty('feed_url', $feed_url);
$items = $this->updateData();
$this->setImported(true);
return $items;
}
示例2: importData
public function importData()
{
$username = $this->getProperty('username');
$url = "http://feeds.launchpad.net/~{$username}/revisions.atom";
try {
$feeds = Zend_Feed::findFeeds($url);
} catch (Zend_Feed_Exception $e) {
return 0;
}
if (!$feeds) {
try {
$items = Zend_Feed::import($url);
} catch (Zend_Feed_Exception $e) {
return 0;
}
$feed_url = $url;
} else {
$items = $feeds[0];
$feed_url = Zend_Feed::getHttpClient()->getUri(true);
}
$title = $items->title();
$this->setProperty('feed_title', $title);
$this->setProperty('feed_url', $feed_url);
$items = $this->updateData();
$this->setImported(true);
return $items;
}
示例3: importData
public function importData()
{
$url = $this->getProperty('url');
$feeds = Zend_Feed::findFeeds($url);
if (!$feeds) {
$items = Zend_Feed::import($url);
$feed_url = $url;
} else {
$items = $feeds[0];
$feed_url = Zend_Feed::getHttpClient()->getUri(true);
}
$this->setProperty('feed_url', $feed_url);
$items = $this->processItems($items, 'published');
$this->setImported(true);
return $items;
}
示例4: importData
public function importData()
{
$url = $this->getProperty('url');
$feeds = Zend_Feed::findFeeds($url);
if (!$feeds) {
$items = Zend_Feed::import($url);
$feed_url = $url;
} else {
$feeds_uri = array_keys($feeds);
$feed_url = $feeds_uri[0];
$items = $feeds[$feed_url];
}
$this->setProperty('feed_url', $feed_url);
$items = $this->processItems($items);
$this->setImported(true);
return $items;
}
示例5: testFindFeedsIncludesUriAsArrayKey
/**
* @issue ZF-5903
*/
public function testFindFeedsIncludesUriAsArrayKey()
{
if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED')) {
$this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection');
return;
}
Zend_Feed::setHttpClient(new Zend_Http_Client());
$feeds = Zend_Feed::findFeeds('http://www.planet-php.net');
$this->assertEquals(array('http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/'), array_keys($feeds));
}
示例6: retrieveSinceLastFetch
function retrieveSinceLastFetch($uri, $idcontact_website = null)
{
$do_website = new ContactWebsite();
$do_website->getid($idcontact_website);
$last_fetch_time = $do_website->feed_last_fetch;
$website_type = $do_website->website_type;
if ($website_type == "RSS Feed") {
try {
$feed = new Zend_Feed_Rss($uri);
$arr_item = array();
$i = 0;
foreach ($feed as $entry) {
if (trim($entry->title()) == trim($entry->description())) {
$str_item .= $entry->description() . "<br />";
} else {
$str_item = "<B>" . $entry->title() . "</B><br />";
$str_item .= $entry->description() . "<br />";
}
$str_item .= " " . date("D, j M Y H:i:s", strtotime($entry->pubDate())) . "<br />";
$arr_item[$i][0] = $str_item;
$arr_item[$i][1] = strtotime($entry->pubDate());
$i++;
if ($last_fetch_time > strtotime($entry->pubDate())) {
break;
}
}
return $arr_item;
} catch (Exception $ex) {
$this->turnFeedOff($idcontact_website);
}
} else {
try {
$obj_arr_feeds = Zend_Feed::findFeeds($uri);
$arr_item = array();
$i = 0;
foreach ($obj_arr_feeds as $channel) {
if ($channel->item) {
//fetches the first (current) updated item
$item = $channel->current();
if (trim($item->title()) == trim($item->description())) {
$str_item .= $item->description() . "<br />";
} else {
$str_item = "<B>" . $item->title() . "</B><br />";
$str_item .= $item->description() . "<br />";
}
$str_item .= " " . date("D, j M Y H:i:s", strtotime($item->pubDate())) . "<br />";
$arr_item[$i][0] = $str_item;
$arr_item[$i][1] = strtotime($item->pubDate());
$i++;
if ($last_fetch_time > strtotime($item->pubDate())) {
break;
}
}
}
return $arr_item;
} catch (Exception $ex) {
$this->turnFeedOff($idcontact_website);
}
}
}