Merge pull request #1572 from basteyy/patch-1
Fix 2 deprecated messages
This commit is contained in:
commit
16c70204dc
2 changed files with 39 additions and 32 deletions
|
@ -632,7 +632,7 @@ class Pages extends dbJSON
|
|||
|
||||
private function sortByPositionLowToHigh($a, $b)
|
||||
{
|
||||
return $a['position'] > $b['position'];
|
||||
return $a['position'] <=> $b['position'];
|
||||
}
|
||||
private function sortByPositionHighToLow($a, $b)
|
||||
{
|
||||
|
|
|
@ -548,13 +548,14 @@ class Page
|
|||
$past = new DateTime($this->getValue('dateRaw'));
|
||||
$elapsed = $current->diff($past);
|
||||
|
||||
$elapsed->w = floor($elapsed->d / 7);
|
||||
$elapsed->d -= $elapsed->w * 7;
|
||||
// Calculate weeks separately
|
||||
$weeks = floor($elapsed->d / 7);
|
||||
$elapsed->d -= $weeks * 7;
|
||||
|
||||
$string = array(
|
||||
'y' => 'year',
|
||||
'm' => 'month',
|
||||
'w' => 'week',
|
||||
'w' => $weeks,
|
||||
'd' => 'day',
|
||||
'h' => 'hour',
|
||||
'i' => 'minute',
|
||||
|
@ -562,8 +563,14 @@ class Page
|
|||
);
|
||||
|
||||
foreach ($string as $key => &$value) {
|
||||
if ($elapsed->$key) {
|
||||
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : ' ');
|
||||
if ($key == 'w') {
|
||||
if ($weeks > 0) {
|
||||
$value = $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
} else {
|
||||
unset($string[$key]);
|
||||
}
|
||||
} elseif ($elapsed->$key) {
|
||||
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : '');
|
||||
} else {
|
||||
unset($string[$key]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue