1
|
<?php
|
2
|
|
3
|
$starttime = explode(' ', microtime());
|
4
|
$starttime = $starttime[1] + $starttime[0];
|
5
|
|
6
|
|
7
|
|
8
|
include_once('../autoloader.php');
|
9
|
include_once('../idn/idna_convert.class.php');
|
10
|
|
11
|
|
12
|
$feed = new SimplePie();
|
13
|
|
14
|
|
15
|
|
16
|
if (isset($_GET['js']))
|
17
|
{
|
18
|
SimplePie_Misc::output_javascript();
|
19
|
die();
|
20
|
}
|
21
|
|
22
|
|
23
|
if (isset($_GET['feed']) && $_GET['feed'] !== '')
|
24
|
{
|
25
|
|
26
|
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
|
27
|
{
|
28
|
$_GET['feed'] = stripslashes($_GET['feed']);
|
29
|
}
|
30
|
|
31
|
|
32
|
$feed->set_feed_url($_GET['feed']);
|
33
|
}
|
34
|
|
35
|
|
36
|
if (!empty($_GET['input']))
|
37
|
{
|
38
|
$feed->set_input_encoding($_GET['input']);
|
39
|
}
|
40
|
|
41
|
|
42
|
if (!empty($_GET['orderbydate']) && $_GET['orderbydate'] == 'false')
|
43
|
{
|
44
|
$feed->enable_order_by_date(false);
|
45
|
}
|
46
|
|
47
|
|
48
|
if (!empty($_GET['force']) && $_GET['force'] == 'true')
|
49
|
{
|
50
|
$feed->force_feed(true);
|
51
|
}
|
52
|
|
53
|
|
54
|
|
55
|
|
56
|
$success = $feed->init();
|
57
|
|
58
|
|
59
|
|
60
|
$feed->handle_content_type();
|
61
|
|
62
|
|
63
|
|
64
|
?><!DOCTYPE html>
|
65
|
|
66
|
<html lang="en-US">
|
67
|
<head>
|
68
|
<title>SimplePie: Demo</title>
|
69
|
|
70
|
<link rel="stylesheet" href="./for_the_demo/sIFR-screen.css" type="text/css" media="screen">
|
71
|
<link rel="stylesheet" href="./for_the_demo/sIFR-print.css" type="text/css" media="print">
|
72
|
<link rel="stylesheet" href="./for_the_demo/simplepie.css" type="text/css" media="screen, projector" />
|
73
|
|
74
|
<script type="text/javascript" src="./for_the_demo/sifr.js"></script>
|
75
|
<script type="text/javascript" src="./for_the_demo/sifr-config.js"></script>
|
76
|
<script type="text/javascript" src="./for_the_demo/sleight.js"></script>
|
77
|
<script type="text/javascript" src="?js"></script>
|
78
|
|
79
|
</head>
|
80
|
|
81
|
<body id="bodydemo">
|
82
|
|
83
|
<div id="header">
|
84
|
<div id="headerInner">
|
85
|
<div id="logoContainer">
|
86
|
<div id="logoContainerInner">
|
87
|
<div align="center"><a href="http://simplepie.org"><img src="./for_the_demo/logo_simplepie_demo.png" alt="SimplePie Demo: PHP-based RSS and Atom feed handling" title="SimplePie Demo: PHP-based RSS and Atom feed handling" border="0" /></a></div>
|
88
|
<div class="clearLeft"></div>
|
89
|
</div>
|
90
|
|
91
|
</div>
|
92
|
<div id="menu">
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
<table cellpadding="0" cellspacing="0" border="0"><tbody><tr><td>
|
98
|
<ul><li id="demo"><a href="./">SimplePie Demo</a></li><li><a href="http://simplepie.org/wiki/faq/start">FAQ/Troubleshooting</a></li><li><a href="http://simplepie.org/support/">Support Forums</a></li><li><a href="http://simplepie.org/wiki/reference/start">API Reference</a></li><li><a href="http://simplepie.org/blog/">Weblog</a></li><li><a href="../test/test.php">Unit Tests</a></li></ul>
|
99
|
|
100
|
<div class="clearLeft"></div>
|
101
|
</td></tr></tbody></table>
|
102
|
</div>
|
103
|
</div>
|
104
|
</div>
|
105
|
|
106
|
<div id="site">
|
107
|
|
108
|
<div id="content">
|
109
|
|
110
|
<div class="chunk">
|
111
|
<form action="" method="get" name="sp_form" id="sp_form">
|
112
|
<div id="sp_input">
|
113
|
|
114
|
|
115
|
|
116
|
<p><input type="text" name="feed" value="<?php if ($feed->subscribe_url()) echo $feed->subscribe_url(); ?>" class="text" id="feed_input" /> <input type="submit" value="Read" class="button" /></p>
|
117
|
|
118
|
|
119
|
</div>
|
120
|
</form>
|
121
|
|
122
|
|
123
|
<?php
|
124
|
|
125
|
if ($feed->error())
|
126
|
{
|
127
|
|
128
|
echo '<div class="sp_errors">' . "\r\n";
|
129
|
|
130
|
|
131
|
echo '<p>' . htmlspecialchars($feed->error()) . "</p>\r\n";
|
132
|
|
133
|
|
134
|
echo '</div>' . "\r\n";
|
135
|
}
|
136
|
?>
|
137
|
|
138
|
|
139
|
<p class="sample_feeds"><strong>Or try one of the following:</strong>
|
140
|
<a href="?feed=http://www.詹姆斯.com/atomtests/iri/everything.atom" title="Test: International Domain Name support">詹姆斯.com</a>,
|
141
|
<a href="?feed=http://www.adultswim.com/williams/podcast/tools/xml/video_rss.xml" title="Humor from the people who make [adult swim] cartoons.">adult swim</a>,
|
142
|
<a href="?feed=http://afterdawn.com/news/afterdawn_rss.xml" title="Ripping, Burning, DRM, and the Dark Side of Consumer Electronics Media">Afterdawn</a>,
|
143
|
<a href="?feed=http://feeds.feedburner.com/ajaxian" title="AJAX and Scripting News">Ajaxian</a>,
|
144
|
<a href="?feed=http://www.andybudd.com/index.rdf&image=true" title="Test: Bypass Image Hotlink Blocking">Andy Budd</a>,
|
145
|
<a href="?feed=http://feeds.feedburner.com/AskANinja" title="Test: Embedded Enclosures">Ask a Ninja</a>,
|
146
|
<a href="?feed=http://www.atomenabled.org/atom.xml" title="Test: Atom 1.0 Support">AtomEnabled.org</a>,
|
147
|
<a href="?feed=http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml" title="World News">BBC News</a>,
|
148
|
<a href="?feed=http://newsrss.bbc.co.uk/rss/arabic/news/rss.xml" title="Test: Windows-1256 Encoding">BBC Arabic</a>,
|
149
|
<a href="?feed=http://newsrss.bbc.co.uk/rss/chinese/simp/news/rss.xml" title="Test: GB2312 Encoding">BBC China</a>,
|
150
|
<a href="?feed=http://newsrss.bbc.co.uk/rss/russian/news/rss.xml" title="Test: Windows-1251 Encoding">BBC Russia</a>,
|
151
|
<a href="?feed=http://inessential.com/xml/rss.xml" title="Developer of NetNewsWire">Brent Simmons</a>,
|
152
|
<a href="?feed=http://www.channelfrederator.com/rss" title="Test: Embedded Enclosures">Channel Frederator</a>,
|
153
|
<a href="?feed=http://rss.cnn.com/rss/cnn_topstories.rss" title="World News">CNN</a>,
|
154
|
<a href="?feed=http://digg.com/rss/index.xml" title="Tech news. Better than Slashdot.">Digg</a>,
|
155
|
<a href="?feed=http://revision3.com/diggnation/feed/quicktime-large" title="Tech and industry videocast.">Diggnation</a>,
|
156
|
<a href="?feed=http://www.flickr.com/services/feeds/photos_public.gne?format=rss2" title="Flickr Photos">Flickr</a>,
|
157
|
<a href="?feed=http://news.google.com/?output=rss" title="World News">Google News</a>,
|
158
|
<a href="?feed=http://video.google.com/videofeed?type=top100new&num=20&output=rss" title="Test: Media RSS Support">Google Video</a>,
|
159
|
<a href="?feed=http://blogs.law.harvard.edu/home/feed/rdf/" title="Test: Tag Stripping">Harvard Law</a>,
|
160
|
<a href="?feed=http://hagada.org.il/hagada/html/backend.php" title="Test: Window-1255 Encoding">Hebrew Language</a>,
|
161
|
<a href="?feed=http://www.infoworld.com/rss/news.xml" title="Test: Ad Stripping">InfoWorld</a>,
|
162
|
<a href="?feed=http://phobos.apple.com/WebObjects/MZStore.woa/wpa/MRSS/topsongs/limit=10/rss.xml&orderbydate=false" title="Test: Tag Stripping">iTunes</a>,
|
163
|
<a href="?feed=http://blog.japan.cnet.com/lessig/index.rdf" title="Test: EUC-JP Encoding">Japanese Language</a>,
|
164
|
<a href="?feed=http://nurapt.kaist.ac.kr/~jamaica/htmls/blog/rss.php&input=EUC-KR" title="Test: EUC-KR Encoding">Korean Language</a>,
|
165
|
<a href="?feed=http://mir.aculo.us/xml/rss/feed.xml" title="Weblog for the developer of Scriptaculous">mir.aculo.us</a>,
|
166
|
<a href="?feed=http://images.apple.com/trailers/rss/newtrailers.rss" title="Apple's QuickTime movie trailer site">Movie Trailers</a>,
|
167
|
<a href="?feed=http://www.newspond.com/rss/main.xml" title="Tech and Science News">Newspond</a>,
|
168
|
<a href="?feed=http://nick.typepad.com/blog/index.rss" title="Developer of TopStyle and FeedDemon">Nick Bradbury</a>,
|
169
|
<a href="?feed=http://feeds.feedburner.com/ok-cancel" title="Usability comics and commentary">OK/Cancel</a>,
|
170
|
<a href="?feed=http://osnews.com/files/recent.rdf" title="News about every OS ever">OS News</a>,
|
171
|
<a href="?feed=http://weblog.philringnalda.com/feed/" title="Test: Atom 1.0 Support">Phil Ringnalda</a>,
|
172
|
<a href="?feed=http://kabili.libsyn.com/rss" title="Test: Improved enclosure type sniffing">Photoshop Videocast</a>,
|
173
|
<a href="?feed=http://www.reddit.com/" title="Top links from around the web">reddit</a>,
|
174
|
<a href="?feed=http://www.pariurisportive.com/blog/xmlsrv/rss2.php?blog=2" title="Test: ISO-8859-1 Encoding">Romanian Language</a>,
|
175
|
<a href="?feed=http://www.erased.info/rss2.php" title="Test: KOI8-R Encoding">Russian Language</a>,
|
176
|
<a href="?feed=http://ryanparman.com/" title="SimplePie developer alumnus">Ryan Parman</a>,
|
177
|
<a href="?feed=http://www.upsaid.com/isis/index.rdf" title="Test: BIG5 Encoding">Traditional Chinese Language</a>,
|
178
|
<a href="?feed=http://technorati.com/watchlists/rss.html?wid=29290" title="Technorati watch for SimplePie">Technorati</a>,
|
179
|
<a href="?feed=http://www.tbray.org/ongoing/ongoing.atom" title="Test: Atom 1.0 Support">Tim Bray</a>,
|
180
|
<a href="?feed=http://tuaw.com/rss.xml" title="Apple News">TUAW</a>,
|
181
|
<a href="?feed=http://www.tvgasm.com/atom.xml&image=true" title="Test: Bypass Image Hotlink Blocking">TVgasm</a>,
|
182
|
<a href="?feed=http://uneasysilence.com/feed/" title="Interesting tech randomness">UNEASYsilence</a>,
|
183
|
<a href="?feed=http://feeds.feedburner.com/web20Show" title="Test: Embedded Enclosures">Web 2.0 Show</a>,
|
184
|
<a href="?feed=http://windowsvistablog.com/blogs/MainFeed.aspx" title="Test: Tag Stripping">Windows Vista Blog</a>,
|
185
|
<a href="?feed=http://xkcd.com/rss.xml" title="Test: LightHTTPd and GZipping">XKCD</a>,
|
186
|
<a href="?feed=http://rss.news.yahoo.com/rss/topstories" title="World News">Yahoo! News</a>,
|
187
|
<a href="?feed=http://gdata.youtube.com/feeds/api/standardfeeds/top_favorites" title="Funny user-submitted videos">You Tube</a>,
|
188
|
<a href="?feed=http://zeldman.com/rss/" title="The father of the web standards movement">Zeldman</a></p>
|
189
|
|
190
|
</div>
|
191
|
|
192
|
<div id="sp_results">
|
193
|
|
194
|
|
195
|
<?php if ($success): ?>
|
196
|
<div class="chunk focus" align="center">
|
197
|
|
198
|
|
199
|
<h3 class="header"><?php if ($feed->get_link()) echo '<a href="' . $feed->get_link() . '">'; echo $feed->get_title(); if ($feed->get_link()) echo '</a>'; ?></h3>
|
200
|
|
201
|
|
202
|
<?php echo $feed->get_description(); ?>
|
203
|
|
204
|
</div>
|
205
|
|
206
|
|
207
|
<?php foreach($feed->get_items() as $item): ?>
|
208
|
<div class="chunk">
|
209
|
|
210
|
|
211
|
<h4><?php if ($item->get_permalink()) echo '<a href="' . $item->get_permalink() . '">'; echo $item->get_title(); if ($item->get_permalink()) echo '</a>'; ?> <span class="footnote"><?php echo $item->get_date('j M Y, g:i a'); ?></span></h4>
|
212
|
|
213
|
|
214
|
<?php echo $item->get_content(); ?>
|
215
|
|
216
|
<?php
|
217
|
|
218
|
if ($enclosure = $item->get_enclosure(0))
|
219
|
{
|
220
|
|
221
|
echo '<div align="center">';
|
222
|
echo '<p>' . $enclosure->embed(array(
|
223
|
'audio' => './for_the_demo/place_audio.png',
|
224
|
'video' => './for_the_demo/place_video.png',
|
225
|
'mediaplayer' => './for_the_demo/mediaplayer.swf',
|
226
|
'altclass' => 'download'
|
227
|
)) . '</p>';
|
228
|
|
229
|
if ($enclosure->get_link() && $enclosure->get_type())
|
230
|
{
|
231
|
echo '<p class="footnote" align="center">(' . $enclosure->get_type();
|
232
|
if ($enclosure->get_size())
|
233
|
{
|
234
|
echo '; ' . $enclosure->get_size() . ' MB';
|
235
|
}
|
236
|
echo ')</p>';
|
237
|
}
|
238
|
if ($enclosure->get_thumbnail())
|
239
|
{
|
240
|
echo '<div><img src="' . $enclosure->get_thumbnail() . '" alt="" /></div>';
|
241
|
}
|
242
|
echo '</div>';
|
243
|
}
|
244
|
?>
|
245
|
|
246
|
</div>
|
247
|
|
248
|
|
249
|
<?php endforeach; ?>
|
250
|
|
251
|
|
252
|
<?php endif; ?>
|
253
|
|
254
|
</div>
|
255
|
|
256
|
<div>
|
257
|
|
258
|
<p class="footnote">Page processed in <?php $mtime = explode(' ', microtime()); echo round($mtime[0] + $mtime[1] - $starttime, 3); ?> seconds.</p>
|
259
|
|
260
|
|
261
|
<p class="footnote">Powered by <a href="<?php echo SIMPLEPIE_URL; ?>"><?php echo SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . ', Build ' . SIMPLEPIE_BUILD; ?></a>. Run the <a href="../compatibility_test/sp_compatibility_test.php">SimplePie Compatibility Test</a>. SimplePie is © 2004–<?php echo date('Y'); ?>, Ryan Parman and Geoffrey Sneddon, and licensed under the <a href="http://www.opensource.org/licenses/bsd-license.php">BSD License</a>.</p>
|
262
|
</div>
|
263
|
|
264
|
</div>
|
265
|
|
266
|
</div>
|
267
|
|
268
|
</body>
|
269
|
</html>
|