當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。