2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: new.inc.php,v 1.3 2003/07/28 07:10:29 arino Exp $
8 // Á´ÂΤÎɽ¼¨¥Õ¥©¡¼¥Þ¥Ã¥È
9 define('NEW_MESSAGE','<span class="comment_date">%s</span>');
11 function plugin_new_init()
13 global $_plugin_new_elapses;
15 // ·Ð²áÉÿô => ¿·Ãåɽ¼¨¥¿¥°
17 '_plugin_new_elapses' => array(
18 1*60*60*24 => ' <span class="new1" title="%s">New!</span>',
19 5*60*60*24 => ' <span class="new5" title="%s">New</span>',
22 set_plugin_messages($messages);
24 function plugin_new_inline()
26 global $vars,$_plugin_new_elapses;
28 if (func_num_args() < 1)
33 $args = func_get_args();
34 $date = strip_htmltag(array_pop($args)); // {}Éôʬ¤Î°ú¿ô
35 if ($date != '' and ($timestamp = strtotime($date)) !== -1)
37 $nodate = in_array('nodate',$args);
38 $timestamp -= ZONETIME;
39 $retval = $nodate ? '' : htmlspecialchars($date);
43 $name = strip_bracket(count($args) ? array_shift($args) : $vars['page']);
44 $page = get_fullname($name,$vars['page']);
45 $nolink = in_array('nolink',$args);
47 if (substr($page,-1) == '/')
49 foreach (preg_grep('/^'.preg_quote($page,'/').'/',get_existpages()) as $page)
51 $_timestamp = get_filetime($page);
52 if ($timestamp < $_timestamp)
54 $retval = $nolink ? '' : make_pagelink($page); // ºÇ¤â¿·¤·¤¤¥Ú¡¼¥¸¤òɽ¼¨
55 $timestamp = $_timestamp;
59 else if (is_page($page))
61 $retval = $nolink ? '' : make_pagelink($page,$name);
62 $timestamp = get_filetime($page);
70 $erapse = UTIME - $timestamp;
71 foreach ($_plugin_new_elapses as $limit=>$tag)
73 if ($erapse <= $limit)
75 $retval .= sprintf($tag,get_passage($timestamp));
79 return sprintf(NEW_MESSAGE,$retval);