git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e48e424
)
nieuws: generic date formatting function
author
Mischa POSLAWSKY
<perl@shiar.org>
Fri, 10 Aug 2018 23:13:53 +0000
(
01:13
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 11 Aug 2018 05:33:59 +0000
(07:33 +0200)
nieuws.inc.php
patch
|
blob
|
history
diff --git
a/nieuws.inc.php
b/nieuws.inc.php
index 57c53fc9b57884d148b3fa4a1cba6a967daabbca..713347490441bbbb79844e837d6e76aa312005f3 100644
(file)
--- a/
nieuws.inc.php
+++ b/
nieuws.inc.php
@@
-5,15
+5,20
@@
$monthname = ['?',
'juli', 'augustus', 'september', 'oktober', 'november', 'december',
];
'juli', 'augustus', 'september', 'oktober', 'november', 'december',
];
-function show
newsdate($url
)
+function show
date($parts
)
{
{
- if (!preg_match('</(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return;
global $monthname;
return implode(' ', array_filter([
intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
]));
}
global $monthname;
return implode(' ', array_filter([
intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
]));
}
+function shownewsdate($url)
+{
+ if (!preg_match('</(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return;
+ return showdate($parts);
+}
+
function shownewsimage($url)
{
foreach (['jpg', 'png'] as $ext) {
function shownewsimage($url)
{
foreach (['jpg', 'png'] as $ext) {