本文整理汇总了PHP中Zend_Feed::importBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed::importBuilder方法的具体用法?PHP Zend_Feed::importBuilder怎么用?PHP Zend_Feed::importBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed
的用法示例。
在下文中一共展示了Zend_Feed::importBuilder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: streamFeed
/**
*
* @param $streamEntries
* @param $format
* @return Zend_Feed_Abstract
*/
public function streamFeed($streamEntries, $format = 'atom')
{
$entries = array();
foreach ($streamEntries as $entry) {
$updatedAt = $this->view->date($entry->updated_at);
$entry = array('title' => $entry->title, 'link' => $this->view->appUrl() . $this->view->url(array('action' => 'show', 'id' => $entry->id, 'format' => null)), 'description' => $entry->title, 'guid' => $entry->id, 'lastUpdate' => $updatedAt->get(Zend_Date::TIMESTAMP), 'source' => array('title' => $entry->title, 'url' => $entry->url));
$entries[] = $entry;
}
//$entry = $this->entries->getItem(0);
//$updatedAt = $this->date($entry->updated_at);
//$createdAt = $this->date($entry->created_at);
$data = array('title' => 'My Lifestream', 'link' => $this->view->appUrl(), 'charset' => 'utf-8', 'generator' => 'PHP Lifestream', 'language' => 'language the feed is written in', 'ttl' => '5', 'entries' => $entries);
$feedBuilder = new Zend_Feed_Builder($data);
return Zend_Feed::importBuilder($feedBuilder, $format);
}
示例2: fetch
public function fetch()
{
if (!$this->loadFeeds()) {
throw new Exception('Failed to load feeds');
}
$mergedFeedEntries = new RssMergedEntryList();
foreach ($this->feeds as $feed) {
foreach ($feed as $entry) {
$toMergeEntry = new Zend_Feed_Builder_Entry($entry->title(), $entry->link(), $entry->description());
$toMergeEntry->setLastUpdate(strtotime($entry->pubDate()));
$mergedFeedEntries->insert($toMergeEntry);
}
}
$header = new Zend_Feed_Builder_Header($this->getTitle(), $this->getLink());
$rssBuilder = new RssFeedBuilder($header, iterator_to_array($mergedFeedEntries));
$mergedFeed = Zend_Feed::importBuilder($rssBuilder);
return $mergedFeed->saveXml();
}
示例3: indexAction
/**
* The default action for the rss controller
* Which shows the rss document
*/
public function indexAction()
{
$blog_mapper = new Application_Model_EntryMapper();
$blogs = $blog_mapper->findAll(10);
//Create an array for our rss
$feedData = array();
//Seting up the head information of the rss
$feedData['title'] = $this->message_details['blog'] . ' - The Blog';
$feedData['link'] = $this->baseUrl();
$feedData['published'] = time();
//Set the published date to now
$feedData['charset'] = 'utf-8';
$feedData['language'] = 'en';
$feedData['logo'] = $this->baseUrl() . '/images/logo.png';
$feedData['entries'] = array();
//Looping through the news to add them to the 'entries' array.
foreach ($blogs as $blog) {
$entry = array();
//Container for the entry before we add it on
$entry['title'] = $blog->title;
//The title of the news
$entry['link'] = $this->baseUrl() . $this->view->EntryUrl($blog);
$entry['description'] = $blog->description;
//a brief of the news
//$entry['content'] = $blog->content; //details of the news
$entry['lastUpdate'] = $blog->published_date;
$feedData['entries'][] = $entry;
}
// create our feed object and import the data
$feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($feedData), 'rss');
//disabling the layout and the rendering
$this->getHelper('layout')->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
//printing the rss feed to standard output
$feed->saveXML();
//sending the HTTP headers and output the rss feed
$feed->send();
}
示例4: testAtomGetLink
/**
* Test the return of a link() call (atom)
*/
public function testAtomGetLink()
{
$feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom');
$this->assertTrue($feed instanceof Zend_Feed_Atom);
$feed = Zend_Feed::importString($feed->saveXML());
$this->assertTrue($feed instanceof Zend_Feed_Atom);
$href = $feed->link('self');
$this->assertTrue($href == 'http://www.example.com');
}
示例5: testAtomGetLink
/**
* Test the return of a link() call (atom)
*/
public function testAtomGetLink()
{
$feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom');
$this->assertType('Zend_Feed_Atom', $feed);
$feed = Zend_Feed::importString($feed->saveXml());
$this->assertType('Zend_Feed_Atom', $feed);
$href = $feed->link('self');
$this->assertEquals('http://www.example.com', $href);
}
示例6: rssAction
/**
* rssAction
* @author Daniel Rotter <daniel.rotter@massiveart.com>
* @version 1.0
*/
public function rssAction()
{
header('Content-type: application/rss+xml');
$this->blnRenderMaster = false;
require_once dirname(__FILE__) . '/../helpers/FeedBuilder.php';
$objFeed = Zend_Feed::importBuilder(new Blog_FeedBuilder(Zend_Registry::get('Widget')), 'rss');
$this->view->assign('text', $objFeed->saveXml());
}