CMS  Version 3.9
pull_feeds.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("rss_feed");
3 Fakoli::usingFeature("data_view");
4 
5 $menu_item = "RSS Feeds";
6 
7 $rssFeeds = Query::create(RSSFeed, "ORDER BY rss_feed_id")->execute();
8 echo "The following feed content have been updated:</br>";
9 
10 foreach($rssFeeds as $feed)
11 {
12  echo $feed_id = $feed->rss_title."</br>";
13 
14  $rssurl = simplexml_load_file($feed->rss_url,"SimpleXMLElement", LIBXML_NOCDATA);
15 
16  foreach ($rssurl->channel->item as $item)
17  {
18  try
19  {
20  $rss = $feed->findArticleByURL($item->link);
21  }
22  catch(DataNotFoundException $e)
23  {
24  $rss = new RSSFeedArticles();
25  }
26 
27  $rss->rss_feed_id = $feed->rss_feed_id;
28  $rss->rss_title = $item->title;
29  $rss->article_date = date("Y-m-d H:i:s", strtotime($item->pubDate));
30  $rss->rss_article_URL = $item->link;
31  $rss->rss_article_newsStory = $item->description;
32  $rss->rss_article_content = $item->children('content',true)->encoded;
33  $rss->rss_thumbnail = $item->children('media', true)->content->attributes();
34  $rss->publish_status = $feed->rss_trusted;
35 
36  $rss->save();
37  }
38 }
39 ?>
40 <br/>
41 <a class='button' href='rss_feed'>&laquo; Back to RSS Feed List</a>
static usingFeature()
Uses the specified framework feature(s).
Definition: core.inc:388
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
$forumRequest to
$rssFeeds
Definition: pull_feeds.inc:7
$menu_item
Definition: pull_feeds.inc:5
$feed_id