From: arino Date: Wed, 30 Apr 2003 08:17:15 +0000 (+0900) Subject: 'new!' pluign update. X-Git-Tag: r1_5_0_rc1~1669 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bb81bc924f7b20faf69d4a021797e589d17d55f4;p=pukiwiki%2Fpukiwiki.git 'new!' pluign update. --- diff --git a/plugin/new.inc.php b/plugin/new.inc.php index 80862c6..bf3ebcd 100644 --- a/plugin/new.inc.php +++ b/plugin/new.inc.php @@ -2,23 +2,29 @@ ///////////////////////////////////////////////// // PukiWiki - Yet another WikiWikiWeb clone. // -// $Id: new.inc.php,v 1.1 2003/04/13 04:47:58 arino Exp $ +// $Id: new.inc.php,v 1.2 2003/04/30 08:17:15 arino Exp $ // -// ¿·Ãåɽ¼¨¤Î´ü¸Â(Æü¿ô) -define('NEW_LIMIT',3); - -// ´ü¸ÂÆâ¤Î¤È¤­É½¼¨¤¹¤ë¥¿¥° -define('NEW_FORMAT','%s'); - -// ɽ¼¨¥Õ¥©¡¼¥Þ¥Ã¥È +// Á´ÂΤÎɽ¼¨¥Õ¥©¡¼¥Þ¥Ã¥È define('NEW_MESSAGE','%s'); -// ¥Ç¥Õ¥©¥ë¥È¤Îɽ¼¨Ê¸»úÎó -define('NEW_STR','New'); - +function plugin_new_init() +{ + global $_plugin_new_elapses; + + // ·Ð²áÉÿô => ¿·Ãåɽ¼¨¥¿¥° + $messages = array( + '_plugin_new_elapses' => array( + 1*60*60*24 => ' New!', + 5*60*60*24 => ' New', + ), + ); + set_plugin_messages($messages); +} function plugin_new_inline() { + global $_plugin_new_elapses; + if (func_num_args() < 1) { return FALSE; @@ -31,28 +37,16 @@ function plugin_new_inline() { return FALSE; } - $timestamp -= LOCALZONE; - - $str = NEW_STR; - $limit = NEW_LIMIT; - - switch (count($args)) - { - case 2: - $str = $args[1]; - case 1: - if (is_numeric($args[0])) - { - $limit = $args[0]; - } - } - $limit *= 60 * 60 * 24; - $retval = htmlspecialchars($date); - - if ((UTIME - $timestamp) <= $limit) + + $erapse = UTIME - $timestamp + LOCALZONE; + foreach ($_plugin_new_elapses as $limit=>$tag) { - $retval .= sprintf(NEW_FORMAT,htmlspecialchars($str)); + if ($erapse <= $limit) + { + $retval .= $tag; + break; + } } return sprintf(NEW_MESSAGE,$retval); } diff --git a/skin/default.en.css b/skin/default.en.css index 2f34ce2..b938fbb 100644 --- a/skin/default.en.css +++ b/skin/default.en.css @@ -604,14 +604,17 @@ div.jumpmenu{ { font-size:x-small; } -.new +.new1 { - color:white; - background-color:darkcyan; + color:red; + background-color:transparent; + font-size:x-small; +} +.new5 +{ + color:green; + background-color:transparent; font-size:xx-small; - font-weight:bold; - padding:1px; - margin:0px .5em 0px .5em; } /* aname.inc.php */ diff --git a/skin/default.ja.css b/skin/default.ja.css index ee295e8..92fe819 100644 --- a/skin/default.ja.css +++ b/skin/default.ja.css @@ -605,14 +605,17 @@ div.jumpmenu{ { font-size:x-small; } -.new +.new1 { - color:white; - background-color:darkcyan; + color:red; + background-color:transparent; + font-size:x-small; +} +.new5 +{ + color:green; + background-color:transparent; font-size:xx-small; - font-weight:bold; - padding:1px; - margin:0px .5em 0px .5em; } /* aname.inc.php */