OSDN Git Service

BugTrack/2455 new plugin: Backword compatibility: Keep init()
authorumorigu <umorigu@gmail.com>
Mon, 21 May 2018 20:32:56 +0000 (05:32 +0900)
committerumorigu <umorigu@gmail.com>
Mon, 21 May 2018 20:32:56 +0000 (05:32 +0900)
Some external plugins call plugin_new_init() directly
and use the messages.
So we need keep this method for the compatibility.

plugin/new.inc.php

index a0a6ef5..957d5fd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
 // new.inc.php
-// Copyright  2003-2017 PukiWiki Development Team
+// Copyright  2003-2018 PukiWiki Development Team
 // License: GPL v2 or (at your option) any later version
 //
 // New! plugin
 
 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
+               60 * 60 * 24 * 5 => ' <span class="new5" title="%s">New</span>');  // 5days
+       set_plugin_messages($messages);
+}
+
 function plugin_new_inline()
 {
        global $vars;