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


PHP Zend_Feed::importArray方法代码示例

本文整理汇总了PHP中Zend_Feed::importArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed::importArray方法的具体用法?PHP Zend_Feed::importArray怎么用?PHP Zend_Feed::importArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Feed的用法示例。


在下文中一共展示了Zend_Feed::importArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toXml

 /**
  * Get xml from feed data
  *
  * @codeCoverageIgnore due to static method call (\Zend_Feed::importArray)
  *
  * @param FeedInterface $feed
  * @return string
  */
 public function toXml(FeedInterface $feed)
 {
     $data = ['title' => $feed->getTitle(), 'link' => $feed->getLink(), 'charset' => 'UTF-8', 'description' => $feed->getDescription()];
     $rssFeedFromArray = $this->zendFeed->importArray($data, 'rss');
     $xml = $rssFeedFromArray->saveXML();
     return $xml;
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:15,代码来源:FeedTransformer.php

示例2: recentlyAdded

 function recentlyAdded()
 {
     // redirect user if not logged in
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
     } elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index"));
     }
     $t_object = new ca_objects();
     $va_recently_added_objects = $t_object->getRecentlyAddedItems(25, array('checkAccess' => caGetUserAccessValues($this->request)));
     $va_entries = array();
     $va_object_ids = array();
     foreach ($va_recently_added_objects as $va_object) {
         $va_object_ids[] = $va_object['object_id'];
     }
     $va_labels = $t_object->getPreferredDisplayLabelsForIDs($va_object_ids);
     // TODO: Need to get object descriptions and last update times properly
     foreach ($va_labels as $vn_object_id => $vs_label) {
         $va_entries[] = array('title' => $vs_label, 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => time(), 'description' => '', 'pubDate' => time());
     }
     $va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
     $o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
     $this->view->setVar('feed', $o_feed);
     $this->render('Feed/feed_recently_added_xml.php');
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:25,代码来源:FeedController.php

示例3: rssAction

 public function rssAction()
 {
     // build the feed array
     $feedArray = array();
     // the title and link are required
     $feedArray['title'] = 'Recent Pages';
     $feedArray['link'] = 'http://localhost';
     // the published timestamp is optional
     $feedArray['published'] = Zend_Date::now()->toString(Zend_Date::TIMESTAMP);
     // the charset is required
     $feedArray['charset'] = 'UTF8';
     // first get the most recent pages
     $mdlPage = new Model_Page();
     $recentPages = $mdlPage->getRecentPages();
     //add the entries
     if (is_array($recentPages) && count($recentPages) > 0) {
         foreach ($recentPages as $page) {
             // create the entry
             $entry = array();
             $entry['guid'] = $page->id;
             $entry['title'] = $page->headline;
             $entry['link'] = 'http://localhost/page/open/title/' . $page->name;
             $entry['description'] = $page->description;
             $entry['content'] = $page->content;
             // add it to the feed
             $feedArray['entries'][] = $entry;
         }
     }
     // create an RSS feed from the array
     $feed = Zend_Feed::importArray($feedArray, 'rss');
     // now send the feed
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $feed->send();
 }
开发者ID:mtaha1990,项目名称:onlineDR,代码行数:35,代码来源:FeedController.php

示例4: _getFeedXml

 private function _getFeedXml()
 {
     $host = isset($_SERVER['HTTP_HOST']) ? 'http://' . $_SERVER['HTTP_HOST'] : '';
     $feedArray = array('title' => $this->_getRssTitle(), 'link' => $host . $this->getUrl(), 'charset' => 'utf-8', 'description' => '', 'copyright' => Zend_Registry::get('config')->application->name, 'generator' => 'Koala Framework', 'language' => $this->getData()->getLanguage(), 'entries' => $this->_getRssEntries());
     $feed = Zend_Feed::importArray($feedArray, 'rss');
     return $feed->saveXml();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Component.php

示例5: feed

 public static function feed()
 {
     $ncsu = new Tweetgater_Twitter();
     $down = false;
     try {
         $timeline = $ncsu->getTimeline();
     } catch (Exception $e) {
         $down = true;
     }
     $config = $ncsu->getConfigFile();
     $fa = array();
     $fa['title'] = $config->feed->title;
     $fa['link'] = $config->site->url . '/feed.php';
     $fa['charset'] = 'UTF-8';
     $fa['author'] = $config->feed->title;
     $entries = array();
     if (!$down) {
         foreach ($timeline as $t) {
             $temp = array();
             $temp['title'] = 'Tweet by @' . $t['user-screen_name'];
             $temp['link'] = 'http://www.twitter.com/' . $t['user-screen_name'] . '/status/' . $t['id'];
             $temp['description'] = $t['text'] . '<br /><br />Follow @<a href="http://www.twitter.com/' . $t['user-screen_name'] . '">' . $t['user-screen_name'] . '</a>';
             $temp['lastUpdate'] = strtotime($t['created_at']);
             $entries[] = $temp;
         }
     }
     $fa['entries'] = $entries;
     // importing a rss feed from an array
     $rssFeed = Zend_Feed::importArray($fa, 'rss');
     // send http headers and dump the feed
     $rssFeed->send();
 }
开发者ID:rswilli2,项目名称:Mobile-Website,代码行数:32,代码来源:Display.php

示例6: recentlyAdded

 function recentlyAdded()
 {
     // redirect user if not logged in
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
     } elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index"));
     }
     $t_object = new ca_objects();
     if (($vn_num_items = (int) $this->request->config->get('rss_number_of_items')) <= 0) {
         $vn_num_items = 10;
     }
     $va_recently_added_objects = $t_object->getRecentlyAddedItems($vn_num_items, array('checkAccess' => caGetUserAccessValues($this->request)));
     $va_entries = array();
     $va_object_ids = array();
     foreach ($va_recently_added_objects as $va_object) {
         $va_object_ids[] = $va_object['object_id'];
     }
     $qr_res = $t_object->makeSearchResult('ca_objects', $va_object_ids);
     $vs_description_bundle = $this->request->config->get('rss_description');
     while ($qr_res->nextHit()) {
         $vn_object_id = $qr_res->get('ca_objects.object_id');
         if (!($vn_creation_time = $t_object->getCreationTimestamp($vn_object_id, array('timestampOnly' => true)))) {
             $vn_creation_time = time();
         }
         if (!($vn_update_time = $t_object->getLastChangeTimestamp($vn_object_id, array('timestampOnly' => true)))) {
             $vn_update_time = time();
         }
         $va_entries[] = array('title' => $qr_res->get('ca_objects.preferred_labels.name'), 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => $vn_update_time, 'description' => $vs_description_bundle ? $qr_res->getMediaTag("ca_object_representations.media", "preview") . "\n" . $qr_res->get($vs_description_bundle) : '', 'pubDate' => $vn_creation_time);
     }
     $va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
     $o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
     $this->view->setVar('feed', $o_feed);
     $this->render('Feed/feed_recently_added_xml.php');
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:35,代码来源:FeedController.php

示例7: feedAction

 public function feedAction()
 {
     $woeid = $this->_request->getParam('woeid');
     $ad_type = $this->_request->getParam('ad_type');
     $status = $this->_request->getParam('status');
     $modelAd = new Model_Ad();
     $this->ads = $modelAd->getAdList($woeid, $ad_type, $status, 35);
     $rss['title'] = $this->view->translate($ad_type) . ' ' . $this->view->translate((string) $status) . ' - ' . $this->_helper->woeid->name($woeid, $this->lang) . ' | nolotiro.org';
     $rss['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/rss/feed/woeid/' . $woeid . '/ad_type/' . $ad_type . '/status/' . $status;
     $rss['charset'] = 'utf-8';
     $rss['description'] = 'nolotiro.org - ' . $this->_helper->woeid->name($woeid, $this->lang);
     $rss['language'] = $this->lang;
     $rss['generator'] = 'nolotiro.org';
     $rss['entries'] = array();
     foreach ($this->ads as $value) {
         $entry = array();
         $entry['title'] = $value['title'];
         $entry['link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/ad/' . $value['id'] . '/' . $this->view->slugTitle($value['title']);
         $entry['description'] = $this->view->escapeEmail($value['body']);
         $entry['lastUpdate'] = strtotime($value['date_created']);
         $rss['entries'][] = $entry;
     }
     $feedObj = Zend_Feed::importArray($rss, 'rss');
     return $feedObj->send();
 }
开发者ID:Arteaga2k,项目名称:nolotiro,代码行数:25,代码来源:RssController.php

示例8: displayRss

 /**
  * Display RSS Data
  */
 public function displayRss($array, $type = 'rss')
 {
     $this->loadZend();
     $feed = Zend_Feed::importArray($array, $type);
     $feed->send();
     exit;
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:10,代码来源:Functions.php

示例9: rssAction

 public function rssAction()
 {
     $this->_helper->layout->setLayout('rss');
     //Create an array for our feed
     $feed = array();
     //Setup some info about our feed
     $feed['title'] = "IllustratedPortland.com RSS Feed";
     $feed['link'] = 'feed://illustratedportland.com/blog/rss';
     $feed['charset'] = 'utf-8';
     $feed['language'] = 'en-us';
     //$feed['published'] = time();
     $feed['entries'] = array();
     //Holds the actual items
     foreach ($this->blog_model->getAll() as $story) {
         $entry = array();
         //Container for the entry before we add it on
         $entry['title'] = $story['title'];
         //The title that will be displayed for the entry
         $entry['guide'] = $story['id'];
         $entry['published'] = $story['date'];
         $entry['link'] = 'http://illustratedportland.com/blog/single/id/' . $story['id'];
         //The url of the entry
         $entry['url'] = 'http://illustratedportland.com/blog/single/id/' . $story['id'];
         //The url of the entry
         $entry['description'] = $story['description'];
         //Short description of the entry
         $entry['content'] = $story['content'];
         //Long description of the entry
         $feed['entries'][] = $entry;
     }
     $feedObj = Zend_Feed::importArray($feed, 'rss');
     $this->view->feed = $feedObj->send();
 }
开发者ID:kellancraddock,项目名称:illustrated_portland,代码行数:33,代码来源:BlogController.php

示例10: indexAction

 public function indexAction()
 {
     $format = $this->_request->getParam('format');
     if (in_array($format, array('georss', 'rss', 'atom'))) {
         $news = new News();
         $news = $news->getNews();
         // prepare an array that our feed is based on
         $feedArray = array('title' => 'Latest news from the Portable Antiquities Scheme', 'link' => Zend_Registry::get('siteurl') . '/news/', 'charset' => 'utf-8', 'description' => 'The latest news stories published by the Portable Antiquities Scheme', 'author' => 'The Portable Antiquities Scheme', 'image' => Zend_Registry::get('siteurl') . '/images/logos/pas.gif', 'email' => 'info@finds.org.uk', 'copyright' => 'Creative Commons Licenced', 'generator' => 'The Scheme database powered by Zend Framework and Dan\'s magic', 'language' => 'en', 'entries' => array());
         foreach ($news as $new) {
             $auth = Zend_Auth::getInstance();
             //$latlong = $new['declat'] .' ' .$new['declong'];
             $feedArray['entries'][] = array('title' => $new['title'], 'link' => Zend_Registry::get('siteurl') . '/news/story/id/' . $new['id'], 'guid' => Zend_Registry::get('siteurl') . '/news/story/id/' . $new['id'], 'description' => $this->EllipsisString($new['contents'], 200), 'lastUpdate' => strtotime($new['datePublished']));
             /*if($object['i'] != NULL) {
             		$feedArray['enclosure'][] = array(array(
             		'url' => 'http://www.findsdatabase.org.uk/view/thumbnails/pas/'.$object['i'].'.jpg',
             		'type' => 'image/jpeg' //always sets to jpeg as the thumbnails are derived from there.
             		));
             		}*/
         }
         $feed = Zend_Feed::importArray($feedArray, $format);
         $feed->send();
     } else {
         $this->_redirect('/news/');
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:25,代码来源:StoriesController.php

示例11: createRssXml

 public function createRssXml()
 {
     try {
         $rssFeedFromArray = Zend_Feed::importArray($this->getFeedArray(), 'rss');
         return $rssFeedFromArray->saveXML();
     } catch (Exception $e) {
         return Mage::helper('rss')->__('Error in processing xml. %s', $e->getMessage());
     }
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:9,代码来源:Rss.php

示例12: render

 public function render(array $records)
 {
     $entries = array();
     foreach ($records as $record) {
         $entries[] = $this->itemToRss($record);
         release_object($record);
     }
     $headers = $this->buildRSSHeaders();
     $headers['entries'] = $entries;
     $feed = Zend_Feed::importArray($headers, 'rss');
     return $feed->saveXML();
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:12,代码来源:ItemRss2.php

示例13: _generateFeed

 protected function _generateFeed($news)
 {
     $this->_helper->layout->disableLayout();
     $settings = Zend_Registry::get('environmentSettings');
     $mailSettings = Zend_Registry::get('emailSettings');
     foreach ($news as $post) {
         $entries[] = array('title' => $post->title, 'link' => 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl() . '/news/' . $post->getUrlParams(), 'description' => $post->text, 'content' => $this->view->textile($post->text), 'lastUpdate' => strtotime($post->updated_at));
     }
     // generate and render RSS feed
     $feed = Zend_Feed::importArray(array('title' => $settings->page->group->name, 'link' => 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl() . '/news/feed', 'charset' => 'UTF-8', 'entries' => $entries, 'author' => $settings->page->group->name, 'email' => $mailSettings->email->admin), 'atom');
     $feed->send();
     die;
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:13,代码来源:IndexController.php

示例14: feedAction

 public function feedAction()
 {
     $entries = $this->trackerService->getEntries(array(), 1, 50);
     $feedArray = array('title' => 'Relapse Updates', 'link' => za()->getConfig('site_domain') . za()->getConfig('site_context'), 'description' => 'Latest relapse updates', 'language' => 'en-us', 'charset' => 'utf-8', 'pubDate' => date(DATE_RFC822), 'generator' => 'Zend Framework Zend_Feed', 'entries' => array());
     foreach ($entries as $entry) {
         // we want to handle issue history stuff differently otherwise we end up with oto
         // much crap in the feed
         $desc = $entry->entrydata;
         $feedArray['entries'][] = array('title' => $entry->actionname . ':' . $entry->actionid, 'link' => $entry->url, 'guid' => $entry->id, 'description' => $desc, 'lastUpdate' => strtotime($entry->created));
     }
     $feed = Zend_Feed::importArray($feedArray, 'rss');
     $feed->send();
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:13,代码来源:AdminController.php

示例15: indexAction

 /** Render data for view on index action
  */
 public function indexAction()
 {
     $format = $this->_getParam('format');
     if (!isset($format)) {
         $eventsList = new Events();
         $eventsListed = $eventsList->getUpcomingEvents();
         $calendar = new Calendar();
         $lists = array();
         foreach ($eventsListed as $value) {
             $lists[] = $value['eventStartDate'];
         }
         $listedDates = $lists;
         $calendar->highlighted_dates = $listedDates;
         $first_day = $calendar->year . "-" . $calendar->month . "-01";
         $prev_year = date("Y", strtotime("+2 month", strtotime($first_day)));
         $prev_month = date("m", strtotime("+2 month", strtotime($first_day)));
         $next_year = date("Y", strtotime("+1 month", strtotime($first_day)));
         $next_month = date("m", strtotime("+1 month", strtotime($first_day)));
         $url = $this->view->url(array('module' => 'events', 'controller' => 'upcoming', 'action' => 'index'), 'upcoming', true);
         $calendar->formatted_link_to = $url . '/%Y-%m-%d';
         $this->view->curr = $calendar->output_calendar();
         $this->view->nextplusone = $calendar->output_calendar($prev_year, $prev_month);
         $this->view->next = $calendar->output_calendar($next_year, $next_month);
         $events = new Events();
         if ($this->_getParam('date') == NULL) {
             $this->view->events = $eventsList->getUpcomingEventsList();
             $this->view->eventdate = Zend_Date::now()->toString('yyyy-MM-dd');
         } else {
             $this->view->events = $events->getEventbyDay($this->_getParam('date'));
             $this->view->eventdate = $this->_getParam('date');
         }
     } else {
         if ($format == 'xml' || $format == 'json') {
             $this->_helper->layout->disableLayout();
             $events = new Events();
             $this->view->events = $events->getUpcomingEventsList();
         } else {
             if (in_array($format, array('rss', 'atom')) ? $format : 'rss') {
                 $events = new Events();
                 $events = $events->getUpcomingEventsList();
                 $feedArray = array('title' => 'Finds from the Scheme', 'link' => $this->view->CurUrl(), 'charset' => 'utf-8', 'description' => 'The latest Portable Antiquities Scheme events', 'author' => 'The Portable Antiquities Scheme', 'image' => Zend_Registry::get('siteurl') . '/images/logos/pas.gif', 'email' => 'info@finds.org.uk', 'copyright' => 'Creative Commons Licenced', 'generator' => 'The Scheme database powered by Zend Framework and Dan\'s magic', 'language' => 'en', 'entries' => array());
                 foreach ($events as $event) {
                     $feedArray['entries'][] = array('title' => $event['eventTitle'], 'link' => Zend_Registry::get('siteurl') . '/events/info/index/id/' . $event['id'], 'guid' => Zend_Registry::get('siteurl') . '/events/info/index/id/' . $event['id'], 'description' => strip_tags($event['eventDescription']), 'lastUpdate' => strtotime($event['updated']), 'content' => $event['eventDescription'], 'georss' => $event['latitude'] . ',' . $event['longitude']);
                 }
                 $feed = Zend_Feed::importArray($feedArray, $format);
                 $feed->send();
             }
         }
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:52,代码来源:UpcomingController.php


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