root / drupal7 / sites / all / libraries / simplepie-1.3.1 / demo / test.php @ 4b706e38
1 |
<?php
|
---|---|
2 |
include_once('../autoloader.php'); |
3 |
include_once('../idn/idna_convert.class.php'); |
4 |
|
5 |
// Parse it
|
6 |
$feed = new SimplePie(); |
7 |
if (isset($_GET['feed']) && $_GET['feed'] !== '') |
8 |
{ |
9 |
if (get_magic_quotes_gpc()) |
10 |
{ |
11 |
$_GET['feed'] = stripslashes($_GET['feed']); |
12 |
} |
13 |
$feed->set_feed_url($_GET['feed']); |
14 |
$feed->enable_cache(false); |
15 |
$starttime = explode(' ', microtime()); |
16 |
$starttime = $starttime[1] + $starttime[0]; |
17 |
$feed->init();
|
18 |
$endtime = explode(' ', microtime()); |
19 |
$endtime = $endtime[1] + $endtime[0]; |
20 |
$time = $endtime - $starttime; |
21 |
} |
22 |
else
|
23 |
{ |
24 |
$time = 'null'; |
25 |
} |
26 |
|
27 |
$feed->handle_content_type();
|
28 |
|
29 |
?>
|
30 |
<!DOCTYPE html>
|
31 |
<title>SimplePie Test</title> |
32 |
<pre>
|
33 |
<?php
|
34 |
|
35 |
// memory_get_peak_usage() only exists on PHP 5.2 and higher if PHP is compiled with the --enable-memory-limit configuration option or on PHP 5.2.1 and higher (which runs as if --enable-memory-limit was on, with no option)
|
36 |
if (function_exists('memory_get_peak_usage')) |
37 |
{ |
38 |
var_dump($time, memory_get_usage(), memory_get_peak_usage()); |
39 |
} |
40 |
// memory_get_usage() only exists if PHP is compiled with the --enable-memory-limit configuration option or on PHP 5.2.1 and higher (which runs as if --enable-memory-limit was on, with no option)
|
41 |
else if (function_exists('memory_get_usage')) |
42 |
{ |
43 |
var_dump($time, memory_get_usage()); |
44 |
} |
45 |
else
|
46 |
{ |
47 |
var_dump($time); |
48 |
} |
49 |
|
50 |
// Output buffer
|
51 |
function callable_htmlspecialchars($string) |
52 |
{ |
53 |
return htmlspecialchars($string); |
54 |
} |
55 |
ob_start('callable_htmlspecialchars');
|
56 |
|
57 |
// Output
|
58 |
print_r($feed); |
59 |
ob_end_flush(); |
60 |
|
61 |
?>
|
62 |
</pre>
|