Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
070af9a1
Commit
070af9a1
authored
Mar 15, 2017
by
Côme Chilliet
Browse files
Fixes
#5431
Added date modifier to placeholders
parent
50461200
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/class_templateHandling.inc
View file @
070af9a1
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment