7 |
// RecentChanges の RSS を出力 |
// RecentChanges の RSS を出力 |
8 |
function plugin_rss10_action() |
function plugin_rss10_action() |
9 |
{ |
{ |
10 |
global $script,$rss_max,$page_title,$whatsnew; |
global $rss_max,$page_title,$whatsnew; |
11 |
|
global $trackback; |
12 |
|
|
13 |
|
$self = 'http://'.SERVER_NAME.PHP_SELF.'?'; |
14 |
|
|
15 |
|
$page_title_utf8 = mb_convert_encoding($page_title,'UTF-8',SOURCE_ENCODING); |
16 |
|
|
|
$self = $script.'?'; |
|
|
|
|
|
$page_title_utf8 = $page_title; |
|
|
if (function_exists('mb_convert_encoding')) { |
|
|
$page_title_utf8 = mb_convert_encoding($page_title_utf8,'UTF-8',SOURCE_ENCODING); |
|
|
} |
|
|
|
|
17 |
$items = $rdf_li = ''; |
$items = $rdf_li = ''; |
18 |
|
|
19 |
if (!file_exists(CACHE_DIR.'recent.dat')) { |
if (!file_exists(CACHE_DIR.'recent.dat')) |
20 |
|
{ |
21 |
return ''; |
return ''; |
22 |
} |
} |
23 |
$recent = file(CACHE_DIR.'recent.dat'); |
$recent = file(CACHE_DIR.'recent.dat'); |
24 |
$lines = array_splice($recent,0,$rss_max); |
$lines = array_splice($recent,0,$rss_max); |
25 |
foreach ($lines as $line) { |
foreach ($lines as $line) |
26 |
|
{ |
27 |
list($time,$page) = explode("\t",rtrim($line)); |
list($time,$page) = explode("\t",rtrim($line)); |
28 |
$r_page = rawurlencode($page); |
$r_page = rawurlencode($page); |
29 |
$title = $page; |
$title = mb_convert_encoding($page,'UTF-8',SOURCE_ENCODING); |
|
if (function_exists('mb_convert_encoding')) { |
|
|
$title = mb_convert_encoding($title,'UTF-8',SOURCE_ENCODING); |
|
|
} |
|
30 |
// 'O'が出力する時刻を'+09:00'の形に整形 |
// 'O'が出力する時刻を'+09:00'の形に整形 |
31 |
$dcdate = substr_replace(get_date('Y-m-d\TH:i:sO',$time),':',-2,0); |
$dc_date = substr_replace(get_date('Y-m-d\TH:i:sO',$time),':',-2,0); |
32 |
|
|
33 |
// $desc = get_date('D, d M Y H:i:s T',$time); |
// $desc = get_date('D, d M Y H:i:s T',$time); |
34 |
// <description>$desc</description> |
// <description>$desc</description> |
35 |
|
|
36 |
|
$dc_identifier = $trackback_ping = ''; |
37 |
|
if ($trackback) |
38 |
|
{ |
39 |
|
$tb_id = md5($r_page); |
40 |
|
$dc_identifier = " <dc:identifer>$self$r_page</dc:identifer>"; |
41 |
|
$trackback_ping = " <trackback:ping>{$self}plugin=tb&tb_id=$tb_id</trackback:ping>"; |
42 |
|
} |
43 |
$items .= <<<EOD |
$items .= <<<EOD |
44 |
<item rdf:about="$script?$r_page"> |
<item rdf:about="$self$r_page"> |
45 |
<title>$title</title> |
<title>$title</title> |
46 |
<link>$script?$r_page</link> |
<link>$self$r_page</link> |
47 |
<dc:date>$dcdate</dc:date> |
<dc:date>$dc_date</dc:date> |
48 |
|
$dc_identifier |
49 |
|
$trackback_ping |
50 |
</item> |
</item> |
51 |
|
|
52 |
EOD; |
EOD; |
53 |
$rdf_li .= " <rdf:li rdf:resource=\"$script?$r_page\" />\n"; |
$rdf_li .= " <rdf:li rdf:resource=\"$self$r_page\" />\n"; |
54 |
} |
} |
55 |
|
|
56 |
|
$xmlns_trackback = $trackback ? |
57 |
|
' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : ''; |
58 |
|
|
59 |
header('Content-type: application/xml'); |
header('Content-type: application/xml'); |
60 |
|
|
61 |
print <<<EOD |
print <<<EOD |
63 |
|
|
64 |
<rdf:RDF |
<rdf:RDF |
65 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
66 |
|
$xmlns_trackback |
67 |
xmlns="http://purl.org/rss/1.0/" |
xmlns="http://purl.org/rss/1.0/" |
68 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
69 |
xml:lang="ja"> |
xml:lang="ja"> |
70 |
|
|
71 |
<channel rdf:about="$script?rss"> |
<channel rdf:about="{$self}rss"> |
72 |
<title>$page_title_utf8</title> |
<title>$page_title_utf8</title> |
73 |
<link>$script?$whatsnew</link> |
<link>$self$whatsnew</link> |
74 |
<description>PukiWiki RecentChanges</description> |
<description>PukiWiki RecentChanges</description> |
75 |
<items> |
<items> |
76 |
<rdf:Seq> |
<rdf:Seq> |