From c44555648a5df0390d1010a65ecc173215577daa Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 9 Oct 2012 19:22:59 +0200 Subject: [PATCH] Adds missing class --- .../DateDiffModifierTemplatePlugin.class.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/template/plugin/DateDiffModifierTemplatePlugin.class.php diff --git a/wcfsetup/install/files/lib/system/template/plugin/DateDiffModifierTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/DateDiffModifierTemplatePlugin.class.php new file mode 100644 index 0000000000..c3ac5dc9b5 --- /dev/null +++ b/wcfsetup/install/files/lib/system/template/plugin/DateDiffModifierTemplatePlugin.class.php @@ -0,0 +1,41 @@ + + * @package com.woltlab.wcf + * @subpackage system.template.plugin + * @category Community Framework + */ +class DateDiffModifierTemplatePlugin implements IModifierTemplatePlugin { + /** + * @see wcf\system\template\IModifierTemplatePlugin::execute() + */ + public function execute($tagArgs, TemplateEngine $tplObj) { + if (!isset($tagArgs[1])) { + $tagArgs[1] = TIME_NOW; + } + + $fullInterval = false; + if (isset($tagArgs[2])) { + $fullInterval = $tagArgs[2]; + } + + $startTime = DateUtil::getDateTimeByTimestamp(min($tagArgs[0], $tagArgs[1])); + $endTime = DateUtil::getDateTimeByTimestamp(max($tagArgs[0], $tagArgs[1])); + + return DateUtil::formatInterval($endTime->diff($startTime), $fullInterval); + } +} -- 2.20.1