topical media & game development
portal-classes-core.rss.php
<?PHP
error_reporting(E_ALL);
//include('extern/class.rss20.php');
class Rss {
var Rss20;
function Rss (&this->core = &this->Rss20 = new rss20();
}
function getFeeds () {
sql = "SELECT *
FROM rss_feeds";
this->core->Db->getQueryResults(i = 0 ; rssQueryResults) ; arrFeeds[] = array("id" => i]['id'],
"title" => i]['title'],
"url" => i]['url'] );
}
//
return arrFeeds;
}
function getFeedList () {
this->getFeeds();
list = '';
arrFeeds as list .= '<option value="index.php?FeedId='.feed['name'].'</option>';
}
return contentId = sql = "SELECT content_title, content_binary
FROM content
WHERE content_id = ".contentQueryResult = sql);
echo %^'.%^'.arrFeedItems = array();
articleQueryResults = sql);
for (i < count(i++) {
articleQueryResults[contentQueryResult = sql);
articleQueryResults[this->core->Common->cutText(arrFeedItems;
}
function putRssInDb () {
this->getFeeds();
numberFeedItemsAdded = 0;
i = 0 ; arrFeeds) ; this->Rss20 = new rss20();
arrFeeds[this->Rss20->parse(); // parse de XML-file
this->Rss20->get_items(0);
foreach (item) {
this->getModifiedRssFeed(i]['url'], i]['title'], arrFeedItems);
items);
}
for (i < count(i++) {
arrFeedItems[this->core->Db->getQueryNumRows(numberFeedItemsAlreadyInDb++;
continue;
}
arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[this->core->Db->doQuery(contentId = sql = "INSERT INTO content_type_article (content_id , rss_article)
VALUES (".this->core->Db->doQuery(sql = "INSERT INTO content_matrix (content_id , health , politics , wildlife , energy , business , climate , pollution , technology , lifestyle , environment , region)
VALUES (".arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[arrFeedItems[this->core->Db->doQuery(numberFeedItemsAdded++;
}
echo 'Number feed items added: '.numberFeedItemsAlreadyInDb;
}
function getModifiedRssFeed (feedTitle, result = array();
feedTitle.'(feed)';
switch (result['title'] = result['description'] = trim(strip_tags(result['link'] = result['author'] = result['pub_date'] = arrContentMatrix = item['title'].result['arr_content_matrix'] = result['content_state'] = item['category'], result['region'] = matches[2];
break;
case 'www.globalwarming.org/news/all/feed':
item['title'];
item['link'];
item['description']));
result['region'] = ''; // wordt niet gegeven
item['pubDate'];
this->getContentMatrix(item['description']);
arrContentMatrix['arr_content_matrix'];
arrContentMatrix['content_state'];
break;
case 'newsrss.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss.xml':
item['title'];
item['description']));
item['link'];
result['region'] = '';
item['pubDate'];
this->getContentMatrix(item['description']);
arrContentMatrix['arr_content_matrix'];
arrContentMatrix['content_state'];
break;
case 'dsc.discovery.com/news/subjects/earth/xml/top-stories.xml':
item['title'];
item['link'];
item['description']));
result['region'] = '';
item['pubDate'];
this->getContentMatrix(item['description']);
arrContentMatrix['arr_content_matrix'];
arrContentMatrix['content_state'];
break;
case 'news.nationalgeographic.com/rss/global_warming.rss':
item['title'];
item['link'];
item['description']));
result['region'] = '';
item['pubDate'];
this->getContentMatrix(item['description']);
arrContentMatrix['arr_content_matrix'];
arrContentMatrix['content_state'];
break;
default:
// wanneer de rss feed hier nog niet is opgenomen
item['title'];
item['link'];
item['description']));
result['region'] = '';
item['pubDate'];
this->getContentMatrix(item['description']);
arrContentMatrix['arr_content_matrix'];
arrContentMatrix['content_state'];
}
return contentString) {
contentState = 3;
arrContentMatrix['politics'] = 0;
arrContentMatrix['energy'] = 0;
arrContentMatrix['climate'] = 0;
arrContentMatrix['technology'] = 0;
arrContentMatrix['environment'] = 0;
// De title en descripstion van de feed item kunnen woorden bevatten waaruit de cotegorie afgeleid kan worden
politicsRegex = "/political|politics/";
energyRegex = "/energy|solarpower|greenenergy|green\senergy/";
climateRegex = "/climate|weather/";
technologyRegex = "/technology|technological/";
environmentRegex = "/environment/";
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
if (preg_match(contentString)) {
contentState = 1;
}
arrContentMatrix;
contentState;
return
(C) A. Eliëns
2/9/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.