예제 #1
0
<?php

try {
    include 'FeedGenerator.php';
    $feeds = new FeedGenerator();
    $feeds->setGenerator(new RSSGenerator());
    # or AtomGenerator
    $feeds->setAuthor('*****@*****.**');
    $feeds->setTitle('Example Site');
    $feeds->setChannelLink('http://example.com/rss/');
    $feeds->setLink('http://example.com');
    $feeds->setDescription('Description of channel');
    $feeds->setID('http://example.com/rss/');
    $feeds->addItem(new FeedItem('http://example.com/news/1', 'Example news', 'http://example.com/news/1', '<p>Description of news</p>'));
    $feeds->addItem(new FeedItem('http://example.com/news/2', 'Example news', 'http://example.com/news/2', '<p>Description of news</p>'));
    $feeds->display();
} catch (FeedGeneratorException $e) {
    echo 'Error: ' . $e->getMessage();
}
예제 #2
0
            $stat = stat($file);
            $pl = preg_replace("/{$d}\\//", '', $file);
            $o[$pl] = $stat[9];
        }
    }
}
arsort($o);
$latest = array_slice($o, 0, 10, true);
$mydir = preg_replace('/(.*)\\/.*/', '$1/', $_SERVER['PHP_SELF']);
$self = $prot . $_SERVER['HTTP_HOST'] . $mydir;
//var_dump( $latest );
try {
    include 'feed/FeedGenerator.php';
    $feeds = new FeedGenerator();
    $feeds->setGenerator(new AtomGenerator());
    $feeds->setAuthor('Jart');
    $feeds->setTitle('New and Updated Jart Playlists');
    $feeds->setChanneLink($self);
    $feeds->setLink($self);
    $feeds->setDescription('New and Updated Jart Playlists');
    $feeds->setID($self);
    foreach ($latest as $playlist => $pldate) {
        $shortpl = preg_replace('/.pspl$/', '', $playlist);
        $name = preg_replace('/.*\\/(.*)/', '$1', $shortpl);
        $author = preg_replace('|([^/]*)/.*|', '$1', $playlist);
        $item = new FeedItem("{$self}?pl={$shortpl}", $name, "{$self}?pl={$shortpl}", "<a href=\"{$self}?pl={$shortpl}\">{$name}</a>", date3339($pldate));
        $item->author = $author;
        $feeds->addItem($item);
    }
    $feeds->display();
} catch (FeedGeneratorException $e) {