-
Notifications
You must be signed in to change notification settings - Fork 0
/
Special_SimplePie.php
45 lines (39 loc) · 1.24 KB
/
Special_SimplePie.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
41
42
43
44
45
<?php
defined('is_running') or die('Not an entry point...');
// require_once('simplepie.inc'); //Included in FeedOut.php
require_once('FeedOut.php');
class Special_SimplePie{
var $start;
var $feed;
function Special_SimplePie(){
$feed = new SimplePie();
$start = self::microtime_float();
// Parse it
if (!empty($_GET['feed']))
{
if (get_magic_quotes_gpc())
{
$_GET['feed'] = stripslashes($_GET['feed']);
}
$feed->set_feed_url($_GET['feed']);
$feed->init();
}
$feed->handle_content_type();
echo '<h1>'; echo (empty($_GET['feed'])) ? 'SimplePie' : 'SimplePie: ' . $feed->get_title(); echo '</h1>';
echo '<form action="" method="get" name="sp_form" id="sp_form" style="text-align:center;"><p>
<input type="text" name="feed" value="'; echo ($feed->subscribe_url()) ? htmlspecialchars($feed->subscribe_url()) : 'http://'; echo '" class="text" id="feed_input" /> <input type="submit" value="Read" class="button" />
</p></form>
<div id="sp_results">';
FeedOut($feed);
echo '</div>';
}
function microtime_float(){
if (version_compare(phpversion(), '5.0.0', '>=')){
return microtime(true);
}
else{
list($usec, $sec) = explode(' ', microtime());
return ((float) $usec + (float) $sec);
}
}
}