1 25 26 package org.snipsnap.render.macro; 27 28 import org.radeox.macro.Macro; 29 import org.radeox.macro.BaseMacro; 30 import org.radeox.macro.parameter.MacroParameter; 31 import org.radeox.util.i18n.ResourceManager; 32 import org.snipsnap.app.Application; 33 import org.snipsnap.snip.Modified; 34 import org.snipsnap.snip.Snip; 35 import org.snipsnap.snip.SnipSpaceFactory; 36 37 import java.io.IOException ; 38 import java.io.Writer ; 39 import java.text.MessageFormat ; 40 41 48 49 public class OnlineTimeMacro extends BaseMacro { 50 public String getName() { 51 return "online-time"; 52 } 53 54 public String getDescription() { 55 return ResourceManager.getString("i18n.messages", "macro.onlinetime.description"); 56 } 57 58 public void execute(Writer writer, MacroParameter params) 59 throws IllegalArgumentException , IOException { 60 61 Snip snip = SnipSpaceFactory.getInstance().load(Application.get().getConfiguration().getStartSnip()); 62 MessageFormat mf = new MessageFormat (ResourceManager.getString("i18n.messages", "macro.onlinetime.age"), 63 ResourceManager.getLocale("i18n.messages")); 64 writer.write(mf.format(new Object []{Modified.getNiceTime(snip.getModified().getcTime())})); 65 } 66 } 67 | Popular Tags |