require_once MYBB_ROOT."inc/class_feedparser.php";
$feed_parser = new FeedParser();
$feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
$updated_cache['news'] = array();
require_once MYBB_ROOT . '/inc/class_parser.php';
$post_parser = new postParser();
if($feed_parser->error == '')
{
foreach($feed_parser->items as $item)
{
if(!isset($updated_cache['news'][2]))
{
$description = $item['description'];
$content = $item['content'];
$description = $post_parser->parse_message($description, array(
'allow_html' => true,
)
);
$content = $post_parser->parse_message($content, array(
'allow_html' => true,
)
);
$description = preg_replace('#<img(.*)/>#', '', $description);
$content = preg_replace('#<img(.*)/>#', '', $content);
$updated_cache['news'][] = array(
'title' => htmlspecialchars_uni($item['title']),
'description' => $description,
'link' => htmlspecialchars_uni($item['link']),
'author' => htmlspecialchars_uni($item['author']),
'dateline' => $item['date_timestamp'],
);
}
$stamp = '';
if($item['date_timestamp'])
{
$stamp = my_date('relative', $item['date_timestamp']);
}
$link = htmlspecialchars_uni($item['link']);
$table->construct_cell("<span style=\"font-size: 16px;\"><strong>".htmlspecialchars_uni($item['title'])."</strong></span><br /><br />{$content}<strong><span style=\"float: right;\">{$stamp}</span><br /><br /><a href=\"{$link}\" target=\"_blank\" rel=\"noopener\">» {$lang->read_more}</a></strong>");
$table->construct_row();
}
}
else
{
$table->construct_cell("{$lang->error_fetch_news} <!-- error code: {$feed_parser->error} -->");
$table->construct_row();
}