Commit 070af9a1 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5431 Added date modifier to placeholders

parent 50461200
......@@ -355,6 +355,18 @@ class templateHandling
return $res;
}
private static function modifierDate(array $args)
{
if (count($args) < 1) {
$args[] = 'now';
}
if (count($args) < 2) {
$args[] = 'd.m.Y';
}
$dateObject = new DateTime($args[0], new DateTimeZone('UTC'));
return array($dateObject->format($args[1]));
}
/*! \brief Apply a modifier
*
* \param string $m the modifier
......@@ -432,6 +444,10 @@ class templateHandling
// random string
$result = array(static::modifierRandomString($args));
break;
case 'd':
// date
$result = array(static::modifierDate($args));
break;
default:
trigger_error("Unkown modifier '$m'");
$result = array($str);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment