MenuBarなどに張ったリンクに対して、内容が更新された場合にNEW!などと表示して欲しいです。&newは現在&new{日付};で日付が書きこみなどで更新される場合にはよいですが、MenuBar等に置いて別のページの更新はチェックできません。そこで、&new{ページ名};のように仕様を拡張して、これが出来るようになれば便利だと思います。いかがでしょうか?是非欲しい機能です。
&new{日付}; &new(ページ名);現状でも日付のページ(yyyy-mm-dd)が存在するとnewの判定が失敗するので、そもそもの仕様としては{}でなく()内で指定するのが正しいのかもしれません。(移行が非常に悩ましいですが)
&new{日付}; &new(日付1){日付2}; 日付1を採用 日付2を無視 &new(ページ名);
Index: new.inc.php =================================================================== RCS file: /cvsroot/pukiwiki/pukiwiki/plugin/new.inc.php,v retrieving revision 1.2 diff -u -r1.2 new.inc.php --- new.inc.php 30 Apr 2003 08:17:15 -0000 1.2 +++ new.inc.php 14 Jul 2003 05:39:54 -0000 @@ -31,15 +31,26 @@ } $args = func_get_args(); - - $date = array_pop($args); - if (($timestamp = strtotime($date)) === -1) + $date = array_pop($args); // {}部分の引数 + if (count($args)) + { + $date = join(',',$args); // ()部分の引数があればそちらを採用 + } + if (is_page($date)) + { + $timestamp = get_filetime($date); + $retval = make_pagelink($date); + } + else if (($timestamp = strtotime($date)) !== -1) + { + $timestamp -= LOCALZONE; + $retval = htmlspecialchars($date); + } + else { return FALSE; } - $retval = htmlspecialchars($date); - - $erapse = UTIME - $timestamp + LOCALZONE; + + $erapse = UTIME - $timestamp; foreach ($_plugin_new_elapses as $limit=>$tag) { if ($erapse <= $limit)
&new(ページ名/*);のような記述の方法で可能にできないものでしょうか?#trackerを使っている場合などにありがたみ倍増です。 -- sha 2003-07-14 (月) 19:45:05
if (is_page($date)) { $timestamp = get_filetime($date); $retval = make_pagelink($date); } + //else if ( preg_match("/\/\*$/", $date) ){ + else if ( substr($date, -2) === "/*" ) { + $refer_len = strlen($date)-2; + $refer = substr($date, 0, $refer_len); + $timestamp = 0; + $retval = ""; + foreach (get_existpages() as $_page) + { + if (strpos($_page,$refer) === 0) + { + $tm = get_filetime($_page); + if ( $timestamp < $tm ) { + $timestamp = $tm; + $retval = make_pagelink($_page); + } + } + } + } else if (($timestamp = strtotime($date)) !== -1) { $timestamp -= LOCALZONE; $retval = htmlspecialchars($date); }
function plugin_new_init() { + global $_maxsec; .... + $_maxsec = 0; + foreach ( $_plugin_new_elapses as $key=>$val ) + { + if ( $_maxsec < $key ) $_maxsec = $key; + } }
function plugin_new_inline() { + global $_maxsec; .... + //else if ( preg_match("/\/\*$/", $date) ){ + else if ( substr($date, -2) === "/*" ) { + $refer_len = strlen($date)-1; + $refer = substr($date, 0, $refer_len); + $timestamp = UTIME - $_maxsec; + $retval = ""; + foreach (get_existpages() as $_page) + { + if (strpos($_page,$refer) === 0) + { + $tm = get_filetime($_page); + if ( $timestamp < $tm ) { + $timestamp = $tm; + $retval = make_pagelink($_page); + } + } + } + if ( $retval === "" ) $timestamp = 0; + }
&new(nostring,2003-07-28 (月) 13:38:41); &new(nostring,BugTrack/*);
- else if ( ( $timestamp = strtotime($date)) !== -1 ) - { - $timestamp -= LOCALZONE; - $retval = htmlspecialchars($date); - } - else { - return FALSE; - } + else { + // PHP 5.1からのstrtotime()の仕様変更対応 + if(LANG == 'ja') { + $timestamp = strtotime(preg_replace('/\([^\x00-\x7f]+\)/','',$date)); + } else { + $timestamp = strtotime($date); + } + if ($timestamp === -1 || $timestamp === FALSE) { + $timestamp = strtotime("now"); // 何も指定無し now セット + } + $timestamp -= LOCALZONE; + $retval = htmlspecialchars($date); + }
カレントページ &new; ページ指定 &new([page][,nolink]); プレフィクス指定 &new(prefix/[,nolink]); 日付文字列 &new([nodate]){日付文字列};