Created
September 5, 2013 15:59
-
-
Save brennen/6452165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
define('LIBDIR', 'lib/'); | |
require LIBDIR . 'classes/SparkLib/Autoloader.php'; | |
SparkLib\Autoloader::setup(); | |
use FeedWriter\Feed; | |
use FeedWriter\View\JSON; | |
use FeedWriter\View\XML; | |
use FeedWriter\View\CSV; | |
use FeedWriter\View\Atom; | |
// with an iterator | |
$posts = new FakeModelIterator; | |
$entry_from_post = [ | |
'date' => 'date_posted', | |
'author' => function ($item) { return $item->person; }, | |
'link' => 'link', | |
'content' => 'content', | |
'title' => 'content' | |
]; | |
$TestFeed = new Atom; | |
$TestFeed->setTitle('Testing the RSS writer class'); | |
$TestFeed->setLink('http://www.ajaxray.com/rss2/channel/about'); | |
$TestFeed->setDate(new DateTime()); | |
$TestFeed->setChannelElement('author', array('name'=>'Anis uddin Ahmad')); | |
$TestFeed->setSelfLink('http://example.com/myfeed'); | |
$TestFeed->setAtomLink('http://pubsubhubbub.appspot.com', 'hub'); | |
$feed = new Feed($posts, $entry_from_post, [ | |
'json' => new JSON, | |
'csv' => new CSV, | |
'atom' => $TestFeed | |
]); | |
echo $feed->json->generateFeed() . "\n"; | |
echo $feed->csv->generateFeed() . "\n"; | |
echo $feed->atom->generateFeed(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment