Exemplo n.º 1
0
$urls = array();
//load combined api file
$api = file_get_contents($communities);
$json = json_decode($api, true);
$geofeatures = $json['features'];
// get additional feeds from config
foreach ($configs['additionalFeeds'] as $additionalFeed) {
    if ($additionalFeed['category'] == $category) {
        $feeds[$additionalFeed['name']] = array($additionalFeed['url'], $additionalFeed['name'], $additionalFeed['homepage']);
    }
}
// get feeds from API
foreach ($geofeatures as $feature) {
    if (!empty($feature['properties']['feeds'])) {
        foreach ($feature['properties']['feeds'] as $feed) {
            if (!array_key_exists($feature['properties']['url'], $urls) && !empty($feed['category']) && $feed['category'] == $category && !empty($feed['type']) && $feed['type'] == "rss") {
                $feeds[$feature['properties']['shortname']] = array($feed['url'], $feature['properties']['name'], $feature['properties']['url']);
                $urls[$feature['properties']['url']] = "1";
            }
        }
    }
}
// set the header type
header("Content-type: text/xml");
// set an arbitrary feed date
$feed_date = date("r", mktime(10, 0, 0, 9, 8, 2010));
// Create new MergedRSS object with desired parameters
$MergedRSS = new MergedRSS($feeds, "Fossasia Community Feeds", "http://www.fossasia.net/", "This the merged RSS feed of RSS feeds of our community", $feed_date);
//Export the first 10 items to screen
$result = $MergedRSS->export(true, false, array_key_exists('limit', $_GET) ? $_GET['limit'] : $limit, array_key_exists('source', $_GET) ? $_GET['source'] : 'all');
JsonpHelper::outputXML($result);
Exemplo n.º 2
0
    // set an arbitrary feed date
    $RSS_date = date("r", mktime(10, 0, 0, 9, 8, 2010));
    if (isset($_GET['lang'])) {
        $locale = sanitize($_GET['lang']);
    } else {
        $locale = getOption('locale');
    }
    $gallery = new Gallery();
    // Create new MergedRSS object with desired parameters
    $MergedRSS = new MergedRSS($feeds, getBare(get_language_string($gallery->getTitle(), $locale)), FULLWEBPATH, getBare(get_language_string($gallery->getDesc(), $locale)), $RSS_date);
    //Export the first 10 items to screen
    $mergedrss_feeditems = getOption('mergedrss_items');
    if (empty($mergedrss_feeditems)) {
        $mergedrss_feeditems = 10;
    }
    $MergedRSS->export(false, true, $mergedrss_feeditems);
    //getOption('RSS_items')
    exitZP();
}
class MergedRSSOptions
{
    function __construct()
    {
        if (OFFSET_PATH == 2) {
            setOptionDefault('mergedrss_items', 10);
        }
    }
    function getOptionsSupported()
    {
        return array(gettext('RSS feeds to merge') => array('key' => 'mergedrss_feeds', 'type' => OPTION_TYPE_TEXTAREA, 'order' => 11, 'multilingual' => false, 'desc' => gettext('Enter the full urls of the feeds to merge separated by semicolons (e.g. "http://www.domain1.com/rss; http://www.domain2.com/rss")')), gettext('Feed items:') => array('key' => 'mergedrss_items', 'type' => OPTION_TYPE_NUMBER, 'order' => 2, 'desc' => gettext("The number of new entries you want to appear in your site’s RSS feed")));
    }
Exemplo n.º 3
0
$json = json_decode($api, true);
$geofeatures = $json['features'];
// place our feeds in an array for categories with static feeds
switch ($category) {
    case "blog":
        $feeds = array(array('http://blog.freifunk.net/rss.xml', 'blog.freifunk.net', 'http://blog.freifunk.net'), array('http://freifunkstattangst.de/feed/', 'freifunk statt Angst', 'http://freifunkstattangst.de'), array('http://radio.freifunk-bno.de/freifunk_radio_feedfeed.xml', 'Freifunk Radio', 'http://wiki.freifunk.net/Freifunk.radio'));
        break;
    case "podcast":
        $feeds = array(array('http://radio.freifunk-bno.de/freifunk_radio_feedfeed.xml', 'Freifunk Radio', 'http://wiki.freifunk.net/Freifunk.radio'));
        break;
    default:
        $feeds = array();
}
foreach ($geofeatures as $feature) {
    if (!empty($feature['properties']['feeds'])) {
        foreach ($feature['properties']['feeds'] as $feed) {
            if (!empty($feed['category']) && $feed['category'] == $category) {
                array_push($feeds, array($feed['url'], $feature['properties']['name'], $feature['properties']['url']));
            }
        }
    }
}
// set the header type
header("Content-type: text/xml");
// set an arbitrary feed date
$feed_date = date("r", mktime(10, 0, 0, 9, 8, 2010));
// Create new MergedRSS object with desired parameters
$MergedRSS = new MergedRSS($feeds, "Freifunk Community Feeds", "http://www.freifunk.net/", "This the merged RSS feed of RSS feeds of our community", $feed_date);
//Export the first 10 items to screen
$MergedRSS->export(false, true, 50);