$xml .= "<title>{$feed_title}</title>";
$xml .= "<atom:link href=\"{$feed_link}\" rel=\"self\" type=\"application/rss+xml\" />";
$xml .= "<link>{$feed_home}</link>";
$xml .= "<description>{$feed_desc}</description>";
$xml .= "<language>{$feed_language}</language>";
$xml .= "<copyright>{$copyright}</copyright>";
$xml .= "<creativeCommons:license>http://creativecommons.org/publicdomain/zero/1.0/legalcode</creativeCommons:license>";
date_default_timezone_set($feed_timezone);
$feed = new SimplePie();
// Load the feeds
$feed->set_feed_url($feeds);
$feed->enable_cache(true);
$feed->set_cache_location('cache');
$feed->set_stupidly_fast(true);
$feed->set_cache_duration($feed_cache_duration);
$feed->get_raw_data(isset($_GET['xmldump']) ? true : false);
$success = $feed->init();
$feed->handle_content_type();
$items = array();
if ($success) {
foreach ($feed->get_items() as $item) {
$item_title = $item->get_title();
$item_permalink = $item->get_permalink();
$link = $item->get_link();
// Normalize link
if (preg_match('/\\Ahttps?:\\/\\/github.com/', $item_permalink)) {
$link = preg_replace('/\\/(commit|releases)\\/(.*)\\Z/', null, $item_permalink);
} else {
if (preg_match('/\\Ahttps?:\\/\\/bitbucket.org/', $item_permalink)) {
$link = preg_replace('/\\/commits\\/(.*)\\Z/', null, $item_permalink);
} else {