<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: new.inc.php,v 1.10 2011/01/25 15:01:01 henoheno Exp $
+// new.inc.php
+// Copyright 2003-2018 PukiWiki Development Team
+// License: GPL v2 or (at your option) any later version
//
// New! plugin
//
function plugin_new_init()
{
+ // Backword compatibility: Keep plugin_new_init() and the messages
// Elapsed time => New! message with CSS
$messages['_plugin_new_elapses'] = array(
60 * 60 * 24 * 1 => ' <span class="new1" title="%s">New!</span>', // 1day
function plugin_new_inline()
{
- global $vars, $_plugin_new_elapses;
+ global $vars;
$retval = '';
$args = func_get_args();
}
}
}
-
- // Add 'New!' string by the elapsed time
- $erapse = UTIME - $timestamp;
- foreach ($_plugin_new_elapses as $limit=>$tag) {
- if ($erapse <= $limit) {
- $retval .= sprintf($tag, get_passage($timestamp));
- break;
- }
- }
-
if($date !== '') {
+ // 1 day hot: <span class="new1">New!</span>
+ // 5 days hot: <span class="new5">New</span>
+ $retval .= '<span class="__plugin_new" data-mtime="' . get_date_atom($timestamp + LOCALZONE) . '"></span>';
// Show a date string
return sprintf(PLUGIN_NEW_DATE_FORMAT, $retval);
} else {