当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Feed::importBuilder方法代码示例

本文整理汇总了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);
 }
开发者ID:johannilsson,项目名称:phplifestream,代码行数:21,代码来源:StreamFeed.php

示例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();
 }
开发者ID:nitropeanut,项目名称:RssFeedMerger,代码行数:18,代码来源:RssFeedMerger.php

示例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();
 }
开发者ID:uuking,项目名称:Lilypad-Zend-Framework-Blog,代码行数:42,代码来源:RssController.php

示例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');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:12,代码来源:ImportTest.php

示例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);
 }
开发者ID:travisj,项目名称:zf,代码行数:12,代码来源:ImportTest.php

示例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());
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:13,代码来源:IndexController.php


注:本文中的Zend_Feed::importBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。