1 |
<?php |
<?php |
2 |
///////////////////////////////////////////////// |
// RSS 1.0 plugin - had been merged into rss plugin |
|
// PukiWiki - Yet another WikiWikiWeb clone. |
|
|
// |
|
3 |
// $Id$ |
// $Id$ |
4 |
// |
|
|
// RecentChanges の RSS を出力 |
|
5 |
function plugin_rss10_action() |
function plugin_rss10_action() |
6 |
{ |
{ |
7 |
global $script,$rss_max,$page_title,$whatsnew; |
pkwk_headers_sent(); |
8 |
global $trackback; |
header('Status: 301 Moved Permanently'); |
9 |
|
header('Location: ' . $script . '?cmd=rss&ver=1.0'); // HTTP |
|
$self = (preg_match('#^https?://#',$script) ? $script : get_script_uri()); |
|
|
if ($self === FALSE) |
|
|
{ |
|
|
die_message("please set '\$script' in ".INI_FILE); |
|
|
} |
|
|
|
|
|
$page_title_utf8 = mb_convert_encoding($page_title,'UTF-8',SOURCE_ENCODING); |
|
|
|
|
|
$items = $rdf_li = ''; |
|
|
|
|
|
if (!file_exists(CACHE_DIR.'recent.dat')) |
|
|
{ |
|
|
return ''; |
|
|
} |
|
|
$recent = file(CACHE_DIR.'recent.dat'); |
|
|
$lines = array_splice($recent,0,$rss_max); |
|
|
foreach ($lines as $line) |
|
|
{ |
|
|
list($time,$page) = explode("\t",rtrim($line)); |
|
|
$r_page = rawurlencode($page); |
|
|
$title = mb_convert_encoding($page,'UTF-8',SOURCE_ENCODING); |
|
|
// 'O'が出力する時刻を'+09:00'の形に整形 |
|
|
$dc_date = substr_replace(get_date('Y-m-d\TH:i:sO',$time),':',-2,0); |
|
|
|
|
|
// $desc = get_date('D, d M Y H:i:s T',$time); |
|
|
// <description>$desc</description> |
|
|
|
|
|
$dc_identifier = $trackback_ping = ''; |
|
|
if ($trackback) |
|
|
{ |
|
|
$tb_id = md5($r_page); |
|
|
$dc_identifier = " <dc:identifier>$self?$r_page</dc:identifier>"; |
|
|
$trackback_ping = " <trackback:ping>$self?plugin=tb&tb_id=$tb_id</trackback:ping>"; |
|
|
} |
|
|
$items .= <<<EOD |
|
|
<item rdf:about="$self?$r_page"> |
|
|
<title>$title</title> |
|
|
<link>$self?$r_page</link> |
|
|
<dc:date>$dc_date</dc:date> |
|
|
$dc_identifier |
|
|
$trackback_ping |
|
|
</item> |
|
|
|
|
|
EOD; |
|
|
$rdf_li .= " <rdf:li rdf:resource=\"$self?$r_page\" />\n"; |
|
|
} |
|
|
|
|
|
$xmlns_trackback = $trackback ? |
|
|
' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : ''; |
|
|
|
|
|
header('Content-type: application/xml'); |
|
|
|
|
|
print <<<EOD |
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
|
|
<rdf:RDF |
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
|
$xmlns_trackback |
|
|
xmlns="http://purl.org/rss/1.0/" |
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
|
xml:lang="ja"> |
|
|
|
|
|
<channel rdf:about="$self?$whatsnew"> |
|
|
<title>$page_title_utf8</title> |
|
|
<link>$self?$whatsnew</link> |
|
|
<description>PukiWiki RecentChanges</description> |
|
|
<items> |
|
|
<rdf:Seq> |
|
|
$rdf_li |
|
|
</rdf:Seq> |
|
|
</items> |
|
|
</channel> |
|
|
|
|
|
$items |
|
|
</rdf:RDF> |
|
|
EOD; |
|
10 |
exit; |
exit; |
11 |
} |
} |
|
?> |
|
12 |
|
?> |