function list_posts($cfg)
{
require_once 'inc/simplepie.inc';
$feed = new SimplePie();
// Set which feed to process.
// handle the different feeds
// blogging
if ($cfg['tumblr'] != "") {
$feeds[] = 'http://' . $cfg['tumblr'] . '.tumblr.com/rss';
}
if ($cfg['blogger'] != "") {
$feeds[] = 'http://' . $cfg['blogger'] . '.blogspot.com/feeds/posts/default?alt=rss';
}
if ($cfg['medium'] != "") {
$feeds[] = 'https://medium.com/feed/@' . $cfg['medium'] . '/';
}
if ($cfg['ghost'] != "") {
$feeds[] = 'http://' . $cfg['ghost'] . '.ghost.io/rss/';
}
if ($cfg['postachio'] != "") {
$feeds[] = 'http://' . $cfg['postachio'] . '.postach.io/feed.xml';
}
if ($cfg['custom'] != "") {
$feeds[] = $cfg['custom'];
}
// plugins
if (file_exists('plugins')) {
$plugins = listFiles('plugins');
if (count($plugins) > 0) {
foreach ($plugins as $plugin) {
$feeds[] = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/plugins/' . $plugin . '/index.php';
}
}
}
$feed->set_feed_url($feeds);
// allow iframe embeds
$strip_htmltags = $feed->strip_htmltags;
array_splice($strip_htmltags, array_search('iframe', $strip_htmltags), 1);
$feed->strip_htmltags($strip_htmltags);
// Run SimplePie.
$feed->init();
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
return $feed;
}