$items = $rdf_li = ''; // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 $file_array = file($recent); // with array_splice() foreach (array_splice($file_array, 0, $rss_max) as $line) { list($time, $page) = explode("\t", rtrim($line)); $r_page = rawurlencode($page); $title = mb_convert_encoding($page, 'UTF-8', SOURCE_ENCODING); switch ($version) { case '0.91': /* FALLTHROUGH */ case '2.0': $date = get_date('D, d M Y H:i:s T', $time); $date = ($version == '0.91') ? '' : ' ' . $date . ''; $retval = plugin_rssdiff_create($page); if ($retval['body'] != '' && $title != 'RecentDeleted') { $desc = ""; $desc = mb_convert_encoding($desc, 'UTF-8', SOURCE_ENCODING); $items .= << $title $self?$r_page $desc $date EOD; } break; case '1.0': $retval = plugin_rssdiff_create($page); // Add into if ($retval['body'] != '' && $title != 'RecentDeleted') { $rdf_li .= ' ' . "\n"; $date = substr_replace(get_date('Y-m-d\TH:i:sO', $time), ':', -2, 0); $trackback_ping = ''; if ($trackback) { $tb_id = md5($r_page); $trackback_ping = ' ' . $self . '?tb_id=' . $tb_id . ''; } $desc = ""; $desc = mb_convert_encoding($desc, 'UTF-8', SOURCE_ENCODING); $items .= << $title $self?$r_page $desc $date $self?$r_page $trackback_ping EOD; } break; } } // Feeding start pkwk_common_headers(); header('Content-type: application/xml'); print '' . "\n\n"; $r_whatsnew = rawurlencode($whatsnew); switch ($version) { case '0.91': print '' . "\n"; /* FALLTHROUGH */ case '2.0': print << $page_title_utf8 $self?$r_whatsnew PukiWiki RecentChanges $lang $items EOD; break; case '1.0': $xmlns_trackback = $trackback ? ' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : ''; print << $page_title_utf8 $self?$r_whatsnew PukiWiki RecentChanges $rdf_li $items EOD; break; } exit; } // 差分を生成 function plugin_rssdiff_create($page) { global $_title, $_title_diff; global $read_auth, $read_auth_pages; // Avoid read_auth pages if ($read_auth) { $matches = array(); foreach ($read_auth_pages as $key=>$val) { if (preg_match($key, $page, $matches)) { return array('msg'=>$_title, 'body'=>$page); } } } $is_page = is_page($page); $filename = DIFF_DIR . encode($page) . '.txt'; if (file_exists($filename)) { $diffdata = htmlspecialchars(join('', file($filename))); $diffdata = preg_replace('/^(\-)(.*)$/m', ' $2', $diffdata); $diffdata = preg_replace('/^(\+)(.*)$/m', ' $2', $diffdata); $msg = "
$diffdata
\n"; } else if ($is_page) { $diffdata = trim(htmlspecialchars(join('', get_source($page)))); $msg = "
$diffdata
\n"; } else { return array('msg'=>$_title_diff, 'body'=>''); } return array('msg'=>$_title_diff, 'body'=>$msg); } ?>