最終更新:
2006-12-24 (日) 08:41:15
プラグインの改造 †
目次 †
counter.inc.php †
- PHP 5.1 以上で昨日のカウンタが0になるバグを修正
86c86
< $is_yesterday = ($counters[$page]['date'] == get_date('Y/m/d', strtotime('yesterday', UTIME)));
---
> $is_yesterday = ($counters[$page]['date'] == get_date('Y/m/d', strtotime('yesterday')));
ls2.inc.php †
- 見出しの一覧だけを表示する title_only オプションを追加
37c37
< foreach (array('title', 'include', 'reverse') as $key)
---
> foreach (array('title', 'title_only', 'include', 'reverse') as $key)
53a54
> 'title_only' => FALSE,
127a129
> if (!$params['title_only']) {
140a143,146
> }
> else if ($is_done) {
> return;
> }
145c151
< if ($params['title'] && preg_match('/^(\*{1,3})/', $line, $matches)) {
---
> if (($params['title'] || $params['title_only']) && preg_match('/^(\*{1,3})/', $line, $matches)) {
147a154
> if ($params['title_only']) $level--;
ls2_1.inc.php †
- 見出しの一覧だけを表示する title_only オプションを追加
180a181
> 'title_only' => false,
484a486
> if (!$params['title_only']) {
533a536
> }
540a544
> if (!$params['title_only']) {
564a569,572
> }
> else if ($is_done) {
> return;
> }
567c575
< if ($params['title'] || $params['include']) {
---
> if ($params['title'] || $params['title_only'] || $params['include']) {
573c581
< if ($params['title'] && preg_match('/^(\*{1,3})/', $line, $matches)) {
---
> if (($params['title'] || $params['title_only']) && preg_match('/^(\*{1,3})/', $line, $matches)) {
588a597
> if ($params['title_only']) $hlevel--;
- FrontPage の場合はページ名を '' として扱うように変更
176a177
> global $defaultpage;
218c219,221
< if ($prefix == '') {
---
> if (strip_bracket($vars['page']) == $defaultpage) {
> $prefix = '';
> } else if ($prefix == '') {
403c406
< return str_replace('$1', htmlspecialchars($prefix), $_ls2_err_nopages);
---
> return '<ul>No pages.</ul>';
lsx.inc.php †
function list_pages()
{
if (sizeof($this->metapages) == 0) {
return;
}
$ul = $pdepth = 1;
foreach ($this->metapages as $i => $metapage) {
$page = $metapage['page'];
$exist = $metapage['exist'];
$depth = $metapage['listdepth'];
if ($exist && $this->options['include'][1] != '') {
$option = "\"$page\"," . csv_implode(',', $this->options['include'][1]);
$html .= do_plugin_convert($this->include, $option);
continue;
}
if ($depth > $pdepth) {
$diff = $depth - $pdepth;
$html .= str_repeat('<ul>', $diff);
$ul += $diff;
} elseif ($depth < $pdepth) {
$diff = $pdepth - $depth;
$html .= str_repeat('</ul>', $diff);
$ul -= $diff;
}
$pdepth = $depth;
if ($exist && $this->options['contents'][1] != '') {
$option = "\"page=$page\"," . csv_implode(',', $this->options['contents'][1]);
$html .= do_plugin_convert($this->contents, $option);
}
}
$html .= str_repeat('</li></ul>', $ul);
return $html;
}
sitemaps.inc.php †
--- plugin.orig/sitemaps.inc.php
+++ plugin/sitemaps.inc.php
@@ -6,7 +6,10 @@
if(!file_exists($recent)) die('recent.dat is not found');
$self = get_script_uri();
- $date = $items = '';
+ $lastmod = $items = '';
foreach(array_splice(file($recent), 0, $sitemaps_max) as $line) {
list($time, $page) = explode("\t", rtrim($line));
+ if (!$lastmod) {
+ $lastmod = date('D, d M Y H:i:s', $time) . ' GMT';
+ }
//sitemapに出したくない(例えば#nofollowになっている)ページの名前を書く
//if(preg_match(/Help|SandBox/S', $page)) continue;
@@ -29,4 +32,5 @@
}
header("Content-type:text/xml;charset=utf-8");
+ header('Last-Modified: ' . $lastmod);
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n\n";
$r_whatsnew = rawurlencode($whatsnew);
topicpath.inc.php †
- FrontPage の時にも Top と表示させる
32c32
< if ($page == '' || $page == $defaultpage) return '';
---
> if ($page == '' || $page == $defaultpage) return PLUGIN_TOPICPATH_TOP_LABEL;
63c63,64
< $topic_path[] = make_pagelink($defaultpage, PLUGIN_TOPICPATH_TOP_LABEL);
---
> $topic_path[] = '<a href="' . $script . '">' .
> PLUGIN_TOPICPATH_TOP_LABEL . '</a>';