forked from mente/php-rss-writer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
40 lines (34 loc) · 1.2 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// Load test target classes
spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//').'.php'; });
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__.'/Source');
use \Suin\RSSWriter\Feed;
use \Suin\RSSWriter\Channel;
use \Suin\RSSWriter\Item;
use \Suin\RSSWriter\Media\MediaContent;
use \Suin\RSSWriter\Media\MediaKeywords;
use \Suin\RSSWriter\Media\MediaCategory;
use \Suin\RSSWriter\Media\MediaRating;
$feed = new Feed();
$feed->escapeTextWithCDATA = false;
$channel = new Channel();
$channel
->title("Channel Title")
->description("Channel Description")
->url('http://blog.example.com')
->language('en-US')
->copyright('Copyright 2012, Foo Bar')
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->ttl(60)
->appendTo($feed);
$item = new Item();
$item
->title("Blog Entry Title")
->description("<div>Blog body</div>")
->url('http://blog.example.com/2012/08/21/blog-entry/')
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
->guid('http://blog.example.com/2012/08/21/blog-entry/', true)
->addChild(new MediaKeywords('keyword1,keyword2'))
->appendTo($channel);
echo $feed; // or echo $feed->render();