OSDN Git Service

PukiWiki version is "1.5.4" / Year 2021
[pukiwiki/pukiwiki.git] / plugin / new.inc.php
index a9306b6..957d5fd 100644 (file)
@@ -1,6 +1,8 @@
 <?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
 //
@@ -15,6 +17,7 @@ define('PLUGIN_NEW_DATE_FORMAT', '<span class="comment_date">%s</span>');
 
 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
@@ -24,7 +27,7 @@ function plugin_new_init()
 
 function plugin_new_inline()
 {
-       global $vars, $_plugin_new_elapses;
+       global $vars;
 
        $retval = '';
        $args = func_get_args();
@@ -81,17 +84,10 @@ function plugin_new_inline()
                        }
                }
        }
-
-       // 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 {