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


PHP Feed类代码示例

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


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

示例1: __setup_crawl__

 /**
  * Planet クロールする
  **/
 public static function __setup_crawl__()
 {
     $http_feed = new Feed();
     foreach (C(PlanetSubscription)->find_all() as $subscription) {
         Exceptions::clear();
         Log::debug(sprintf('[crawl] feed: %d (%s)', $subscription->id(), $subscription->title()));
         try {
             $feed = $http_feed->do_read($subscription->rss_url());
             $subscription->title($feed->title());
             if ($feed->is_link()) {
                 $subscription->link(self::_get_link_href($feed->link()));
             }
             $subscription->rss_url($http_feed->url());
             $subscription->save(true);
             foreach ($feed->entry() as $entry) {
                 Exceptions::clear();
                 try {
                     $planet_entry = new PlanetEntry();
                     $planet_entry->subscription_id($subscription->id());
                     $planet_entry->title(Tag::cdata($entry->title()));
                     $planet_entry->description(Text::htmldecode(Tag::cdata($entry->fm_content())));
                     $planet_entry->link($entry->first_href());
                     $planet_entry->updated($entry->published());
                     $planet_entry->save();
                 } catch (Exception $e) {
                     Log::warn($e->getMessage());
                 }
             }
         } catch (Exception $e) {
             Log::error($e);
         }
     }
 }
开发者ID:riaf,项目名称:Planet,代码行数:36,代码来源:Planet.php

示例2: __construct

 /**
  * Takes a Feed object from a completed search and saves it
  *
  * @param Feed $feed
  */
 public function __construct(Feed $feed)
 {
     $this->upload_dir = wp_upload_dir();
     $this->feed = $feed;
     $this->mls = $feed->mls;
     self::posts($feed->get());
 }
开发者ID:LeapXD,项目名称:wptrebrets,代码行数:12,代码来源:Save.php

示例3: executeEdit

 public function executeEdit($request, $new = false)
 {
     $this->form = new PodcastForm($new ? null : PodcastPeer::retrieveByPk($request->getParameter('id')));
     $this->podcast = $this->form->getObject();
     $this->episodes = $this->podcast->getEpisodes();
     $this->feeds = $this->podcast->getFeeds();
     $this->podcast_feed_form = new FeedForm();
     $this->podcast_feed_form->setDefaults(array('podcast_id' => $this->podcast->getId()), array());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters(), array());
         // FIXME bind to real files array
         if ($this->form->isValid()) {
             $podcast = $this->form->save();
             if ($new) {
                 $feed = new Feed();
                 // add a sensible default feed
                 $feed->setTitle('default');
                 $feed->setSlug('default');
                 $podcast->addFeed($feed);
                 $feed->save();
                 $podcast->setDefaultFeed($feed);
                 $podcast->save();
             }
             $this->redirect('podcast/edit?id=' . $podcast->getId());
         }
     }
 }
开发者ID:WIZARDISHUNGRY,项目名称:sflimetracker,代码行数:27,代码来源:actions.class.php

示例4: updateMemcache

 function updateMemcache()
 {
     // ignore_user_abort();
     //set_time_limit(0);
     //$interval=3600; //(seconds)
     require_once 'model/Feed.php';
     require_once 'lib/BitMemCache.php';
     require_once 'lib/RssReader.php';
     $feed = new Feed();
     $feeds = $feed->getFeeds();
     $logger = LogUtil::getLogger();
     //do{
     include "config/site.php";
     foreach ($feeds as $feed) {
         $url = $feed['url'];
         $mem = new BitMemCache();
         $reader = new RssReader();
         $rss = $reader->fetch($url);
         if (!$rss) {
         } else {
             if ($mem->init()) {
                 $mem->set($url, json_encode($rss));
                 $logger->info("update memcache {$url}");
             }
         }
     }
     //  sleep($interval);
     //}while($memcache);
 }
开发者ID:puregamexyz,项目名称:bitdesign.github.io,代码行数:29,代码来源:BitTimer.php

示例5: testConstructor

 public function testConstructor()
 {
     $f1 = new Feed();
     $this->assertEquals(0, $f1->size());
     $f1->createItem();
     $this->assertEquals(1, $f1->size());
 }
开发者ID:kba,项目名称:rssscrpr,代码行数:7,代码来源:FeedTest.php

示例6: actionCreate

 public function actionCreate($location = null)
 {
     $project = new Project();
     $project->location_id = $location;
     $project->created_by_user_id = Yii::app()->user->id;
     $project->champs = array($project->created_by_user_id);
     if (!isset($_POST['Project'])) {
         $this->render('create', array('model' => $project));
         Yii::app()->end();
     }
     $project->attributes = $_POST['Project'];
     $project->slug = slugify($project->name);
     if (isset($_POST['ajax'])) {
         echo CActiveForm::validate($project, null, false);
         Yii::app()->end();
     }
     if (!$project->validate()) {
         $this->render('create', array('model' => $project));
         Yii::app()->end();
     }
     $feed = new Feed();
     $feed->followers = array($project->created_by_user_id);
     $feed->save();
     $project->feed_id = $feed->id;
     if (!$project->save()) {
         Yii::log('Project::save() failed. $errors = ' . print_r($project->getErrors(), true), 'error', 'app.project.create');
         $form->addError('save', 'Failed save the new project.');
         $this->render('create', array('model' => $project));
         $feed->delete();
         Yii::app()->end();
     }
     $this->renderText('window.parent.location = "' . $this->createUrl('view', array('id' => $project->id)) . '";');
 }
开发者ID:mjrouser,项目名称:cityapi,代码行数:33,代码来源:ProjectController.php

示例7: listnews

 function listnews()
 {
     include "config/site.php";
     require_once 'model/Feed.php';
     $feed = new Feed();
     $feeds = $feed->getFeeds();
     require "view/admin/feednews.php";
 }
开发者ID:puregamexyz,项目名称:bitdesign.github.io,代码行数:8,代码来源:FeedController.php

示例8: isSavedFeed

function isSavedFeed($feedId = '')
{
    if (!class_exists('Feed')) {
        include_once INST_PATH . 'app/models/feed.php';
    }
    $Feed = new Feed();
    return false or $Feed->Find_by_original_id_feed($feedId)->count() > 0;
}
开发者ID:rantes,项目名称:proyectosig,代码行数:8,代码来源:Services_Helper.php

示例9: addEntry

 /**
  * Support method to turn a record driver object into an RSS entry.
  *
  * @param Feed                              $feed   Feed to update
  * @param \VuFind\RecordDriver\AbstractBase $record Record to add to feed
  *
  * @return void
  */
 protected function addEntry($feed, $record)
 {
     $entry = $feed->createEntry();
     $title = $record->tryMethod('getTitle');
     $title = empty($title) ? $record->getBreadcrumb() : $title;
     $entry->setTitle(empty($title) ? $this->translate('Title not available') : $title);
     $serverUrl = $this->getView()->plugin('serverurl');
     $recordLink = $this->getView()->plugin('recordlink');
     try {
         $url = $serverUrl($recordLink->getUrl($record));
     } catch (\Zend\Mvc\Router\Exception\RuntimeException $e) {
         // No route defined? See if we can get a URL out of the driver.
         // Useful for web results, among other things.
         $url = $record->tryMethod('getUrl');
         if (empty($url) || !is_string($url)) {
             throw new \Exception('Cannot find URL for record.');
         }
     }
     $entry->setLink($url);
     $date = $this->getDateModified($record);
     if (!empty($date)) {
         $entry->setDateModified($date);
     }
     $author = $record->tryMethod('getPrimaryAuthor');
     if (!empty($author)) {
         $entry->addAuthor(['name' => $author]);
     }
     $authors = $record->tryMethod('getSecondaryAuthors');
     if (is_array($authors)) {
         foreach ($authors as $author) {
             $entry->addAuthor(['name' => $author]);
         }
     }
     $formats = $record->tryMethod('getFormats');
     if (is_array($formats)) {
         // Take only the most specific format and get rid of level indicator
         // and trailing slash
         $format = end($formats);
         $format = implode('/', array_slice(explode('/', $format), 1, -1));
         $entry->addDCFormat($format);
     }
     $dcDate = $this->getDcDate($record);
     if (!empty($dcDate)) {
         $entry->setDCDate($dcDate);
     }
     $urlHelper = $this->getView()->plugin('url');
     $recordHelper = $this->getView()->plugin('record');
     $recordImage = $this->getView()->plugin('recordImage');
     $imageUrl = $recordImage($recordHelper($record))->getLargeImage();
     $entry->setEnclosure(['uri' => $serverUrl($imageUrl), 'type' => 'image/jpeg', 'length' => 1]);
     $entry->setCommentCount(count($record->getComments()));
     $summaries = $record->tryMethod('getSummary');
     if (!empty($summaries)) {
         $entry->setDescription(implode(' -- ', $summaries));
     }
     $feed->addEntry($entry);
 }
开发者ID:samuli,项目名称:vufind-ere,代码行数:65,代码来源:ResultFeed.php

示例10: actionFeed

 /**
  * Feed ajax 读取
  */
 public function actionFeed()
 {
     $type = Yii::app()->request->getParam('type');
     $uid = Yii::app()->request->getParam('uid');
     $feeds = array();
     $model = new Feed();
     $feeds = $model->getFeeds($uid, $type, $page, $opts);
     $data = array('feeds' => $feeds);
     $this->renderPartial('feed', $data, '', false);
 }
开发者ID:vangogogo,项目名称:justsns,代码行数:13,代码来源:SiteController.php

示例11: getRequestAndAnswer

 public function getRequestAndAnswer()
 {
     $feed = new Feed();
     if ($this->returnAll == false) {
         $content = $_POST['content'];
         echo json_encode($feed->getSpecific($content));
     } else {
         echo json_encode($feed->getAll());
     }
 }
开发者ID:indra1,项目名称:php_advanced_mvc_no_fw_example,代码行数:10,代码来源:index.php

示例12: __construct

 /**
  * Createas a new rss writer
  */
 function __construct(Feed $feed)
 {
     $this->domDoc = new \DOMDocument("1.0", "utf-8");
     $this->domDoc->formatOutput = true;
     $this->CreateRssElement();
     $this->feed = $feed;
     $this->domDoc->appendChild($this->rssElement);
     $channels = $this->feed->GetChannels();
     foreach ($channels as $rssChannel) {
         $this->AddChannel($rssChannel);
     }
 }
开发者ID:agentmedia,项目名称:phine-framework,代码行数:15,代码来源:Writer.php

示例13: rssmaker_plugin_action

function rssmaker_plugin_action($_, $myUser)
{
    if ($_['action'] == 'show_folder_rss') {
        header('Content-Type: text/xml; charset=utf-8');
        $feedManager = new Feed();
        $feeds = $feedManager->loadAll(array('folder' => $_['id']));
        $items = array();
        foreach ($feeds as $feed) {
            $parsing = new SimplePie();
            $parsing->set_feed_url($feed->getUrl());
            $parsing->init();
            $parsing->set_useragent('Mozilla/4.0 Leed (LightFeed Agregator) ' . VERSION_NAME . ' by idleman http://projet.idleman.fr/leed');
            $parsing->handle_content_type();
            // UTF-8 par défaut pour SimplePie
            $items = array_merge($parsing->get_items(), $items);
        }
        $link = 'http://projet.idleman.fr/leed';
        echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
	<channel>
				<title>Leed dossier ' . $_['name'] . '</title>
				<atom:link href="' . $link . '" rel="self" type="application/rss+xml"/>
				<link>' . $link . '</link>
				<description>Aggrégation des flux du dossier leed ' . $_['name'] . '</description>
				<language>fr-fr</language>
				<copyright>DWTFYW</copyright>
				<pubDate>' . date('r', gmstrftime(time())) . '</pubDate>
				<lastBuildDate>' . date('r', gmstrftime(time())) . '</lastBuildDate>
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<generator>Leed (LightFeed Agregator) ' . VERSION_NAME . '</generator>';
        usort($items, 'rssmaker_plugin_compare');
        foreach ($items as $item) {
            echo '<item>
				<title><![CDATA[' . $item->get_title() . ']]></title>
				<link>' . $item->get_permalink() . '</link>
				<pubDate>' . date('r', gmstrftime(strtotime($item->get_date()))) . '</pubDate>
				<guid isPermaLink="true">' . $item->get_permalink() . '</guid>

				<description>
				<![CDATA[
				' . $item->get_description() . '
				]]>
				</description>
				<content:encoded><![CDATA[' . $item->get_content() . ']]></content:encoded>

				<dc:creator>' . ('' == $item->get_author() ? 'Anonyme' : $item->get_author()->name) . '</dc:creator>
				</item>';
        }
        echo '</channel></rss>';
    }
}
开发者ID:kraoc,项目名称:Leed-market,代码行数:52,代码来源:rssmaker.plugin.disabled.php

示例14: findByItemRef

 /**
  * Find item by given itemRef
  *
  * @param Newscoop\News\ItemRef $itemRef
  * @param Newscoop\News\Feed $feed
  * @return Newscoop\News\Item
  */
 public function findByItemRef(ItemRef $itemRef, Feed $feed)
 {
     $item = $this->find($itemRef->getResidRef());
     if (!$item) {
         $item = $feed->getItem($itemRef->getResidRef());
         if ($item) {
             $item->setFeed($feed);
             $this->odm->persist($item);
             $this->odm->flush();
         }
     }
     return $item;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:20,代码来源:ItemService.php

示例15: verifyCurrent

 public function verifyCurrent()
 {
     $current = self::getProperties(true);
     $expired = array();
     $checking = new Feed();
     $checking->start('meta');
     $results = $checking->metaSearch($current);
     $results = $results->toArray();
     //Loop through results, look for unavailable
     foreach ($results as $result) {
         if ($result['Status'] !== "A") {
             $expired[] = $result['Ml_num'];
         }
     }
     return $expired;
 }
开发者ID:LeapXD,项目名称:wptrebrets,代码行数:16,代码来源:Commands.php


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