1 |
panda |
1.1 |
<?php |
2 |
|
|
///////////////////////////////////////////////// |
3 |
|
|
// PukiWiki - Yet another WikiWikiWeb clone. |
4 |
|
|
// |
5 |
arino |
1.9 |
// $Id: rss10.inc.php,v 1.8 2003/07/22 09:26:28 arino Exp $ |
6 |
panda |
1.1 |
// |
7 |
|
|
// RecentChanges ? RSS ???阪?? |
8 |
|
|
function plugin_rss10_action() |
9 |
|
|
{ |
10 |
arino |
1.9 |
global $script,$rss_max,$page_title,$whatsnew; |
11 |
arino |
1.6 |
global $trackback; |
12 |
panda |
1.1 |
|
13 |
arino |
1.9 |
$self = (preg_match('#^https?://#',$script) ? $script : get_script_uri()); |
14 |
|
|
if ($self === FALSE) |
15 |
|
|
{ |
16 |
|
|
die_message("please set '\$script' in ".INI_FILE); |
17 |
|
|
} |
18 |
arino |
1.4 |
|
19 |
|
|
$page_title_utf8 = mb_convert_encoding($page_title,'UTF-8',SOURCE_ENCODING); |
20 |
|
|
|
21 |
panda |
1.1 |
$items = $rdf_li = ''; |
22 |
arino |
1.4 |
|
23 |
|
|
if (!file_exists(CACHE_DIR.'recent.dat')) |
24 |
|
|
{ |
25 |
panda |
1.2 |
return ''; |
26 |
|
|
} |
27 |
|
|
$recent = file(CACHE_DIR.'recent.dat'); |
28 |
|
|
$lines = array_splice($recent,0,$rss_max); |
29 |
arino |
1.4 |
foreach ($lines as $line) |
30 |
|
|
{ |
31 |
panda |
1.2 |
list($time,$page) = explode("\t",rtrim($line)); |
32 |
|
|
$r_page = rawurlencode($page); |
33 |
arino |
1.4 |
$title = mb_convert_encoding($page,'UTF-8',SOURCE_ENCODING); |
34 |
panda |
1.3 |
// 'O'???阪?????????祉??'+09:00'??就???翫就 |
35 |
arino |
1.6 |
$dc_date = substr_replace(get_date('Y-m-d\TH:i:sO',$time),':',-2,0); |
36 |
panda |
1.3 |
|
37 |
|
|
// $desc = get_date('D, d M Y H:i:s T',$time); |
38 |
|
|
// <description>$desc</description> |
39 |
panda |
1.1 |
|
40 |
arino |
1.6 |
$dc_identifier = $trackback_ping = ''; |
41 |
|
|
if ($trackback) |
42 |
|
|
{ |
43 |
|
|
$tb_id = md5($r_page); |
44 |
arino |
1.9 |
$dc_identifier = " <dc:identifer>$self?$r_page</dc:identifer>"; |
45 |
|
|
$trackback_ping = " <trackback:ping>$self?plugin=tb&tb_id=$tb_id</trackback:ping>"; |
46 |
arino |
1.6 |
} |
47 |
panda |
1.1 |
$items .= <<<EOD |
48 |
arino |
1.9 |
<item rdf:about="$self?$r_page"> |
49 |
panda |
1.1 |
<title>$title</title> |
50 |
arino |
1.9 |
<link>$self?$r_page</link> |
51 |
arino |
1.6 |
<dc:date>$dc_date</dc:date> |
52 |
|
|
$dc_identifier |
53 |
|
|
$trackback_ping |
54 |
panda |
1.1 |
</item> |
55 |
|
|
|
56 |
|
|
EOD; |
57 |
arino |
1.9 |
$rdf_li .= " <rdf:li rdf:resource=\"$self?$r_page\" />\n"; |
58 |
panda |
1.1 |
} |
59 |
|
|
|
60 |
arino |
1.6 |
$xmlns_trackback = $trackback ? |
61 |
|
|
' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : ''; |
62 |
|
|
|
63 |
panda |
1.1 |
header('Content-type: application/xml'); |
64 |
|
|
|
65 |
|
|
print <<<EOD |
66 |
|
|
<?xml version="1.0" encoding="utf-8"?> |
67 |
|
|
|
68 |
|
|
<rdf:RDF |
69 |
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/" |
70 |
arino |
1.6 |
$xmlns_trackback |
71 |
panda |
1.1 |
xmlns="http://purl.org/rss/1.0/" |
72 |
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
73 |
|
|
xml:lang="ja"> |
74 |
|
|
|
75 |
arino |
1.9 |
<channel rdf:about="$self?$whatsnew"> |
76 |
panda |
1.1 |
<title>$page_title_utf8</title> |
77 |
arino |
1.9 |
<link>$self?$whatsnew</link> |
78 |
panda |
1.1 |
<description>PukiWiki RecentChanges</description> |
79 |
|
|
<items> |
80 |
|
|
<rdf:Seq> |
81 |
|
|
$rdf_li |
82 |
|
|
</rdf:Seq> |
83 |
|
|
</items> |
84 |
|
|
</channel> |
85 |
|
|
|
86 |
|
|
$items |
87 |
|
|
</rdf:RDF> |
88 |
|
|
EOD; |
89 |
|
|
exit; |
90 |
|
|
} |
91 |
|
|
?> |