forked from php/web-gtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs-rss.php
63 lines (55 loc) · 1.54 KB
/
docs-rss.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
* $Id$
*/
// Send the appropriate header
header('Content-type: application/rss+xml');
// Start output buffering in order to grab the data from the documentation
// CVS updates file (that is echoed when included) and save to a variable
// instead of echoing it right away.
ob_start();
echo '<?xml version=\'1.0\' standalone=\'yes\'?>' . "\n";
include_once 'http://gtk.php.net/manual/en/updates.php';
$xmlstr = ob_get_clean();
$xml = simplexml_load_string($xmlstr);
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel rdf:about="http://gtk.php.net/manual1">
<title>PHP-GTK Manual</title>
<link>http://gtk.php.net/manual1</link>
<description>The PHP-GTK on-line manual</description>
<items>
<rdf:Seq>
<?php
foreach ($xml->a as $link) {
echo ' <rdf:li rdf:resource="' . $link->attributes() . '" />';
echo "\n";
}
?>
</rdf:Seq>
</items>
</channel>
<?php
foreach ($xml->a as $link) {
foreach ($link->attributes() as $key => $value) {
if ($key == 'date') {
$date = date('Y-m-d', strtotime($value));
} else {
$url = $value;
}
}
?>
<item rdf:about="<?php echo $url; ?>">
<title><?php echo $link; ?></title>
<link><?php echo $url; ?></link>
<description>Documentation update: <?php echo $link; ?></description>
<dc:date><?php echo $date; ?></dc:date>
</item>
<?php
}
?>
</rdf:RDF>