Fixed Page ordering to be natural and case insensitive

This commit is contained in:
Matias Griese
2020-12-02 10:41:10 +02:00
parent 30401df4b7
commit 0cee7bcdc8
4 changed files with 6 additions and 6 deletions

View File

@@ -44,7 +44,7 @@
* Fixed `|safe_email` filter to return safe and escaped UTF-8 HTML [#3072](https://github.com/getgrav/grav/issues/3072)
* Fixed exception in CLI GPM and backup commands when `php-zip` is not enabled [#3075](https://github.com/getgrav/grav/issues/3075)
* Fix for XSS advisory [GHSA-cvmr-6428-87w9](https://github.com/getgrav/grav/security/advisories/GHSA-cvmr-6428-87w9)
* Fixed Flex ordering to be natural and case insensitive [flex-objects#87](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/87)
* Fixed Flex and Page ordering to be natural and case insensitive [flex-objects#87](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/87)
# v1.7.0-rc.17
## 10/07/2020

View File

@@ -391,7 +391,7 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa
$list = $new_list;
// Apply manual ordering to the list.
asort($list);
asort($list, SORT_NUMERIC);
}
if ($order_dir !== 'asc') {

View File

@@ -563,8 +563,8 @@ class PageStorage extends FolderStorage
$rawRoute = trim(preg_replace(PageIndex::PAGE_ROUTE_REGEX, '/', "/{$key}") ?? '', '/');
$route = PageIndex::normalizeRoute($rawRoute);
ksort($markdown, SORT_NATURAL);
ksort($children, SORT_NATURAL);
ksort($markdown, SORT_NATURAL | SORT_FLAG_CASE);
ksort($children, SORT_NATURAL | SORT_FLAG_CASE);
$file = array_key_first($markdown[''] ?? (reset($markdown) ?: []));
@@ -628,7 +628,7 @@ class PageStorage extends FolderStorage
$list[$storage_key] = $meta;
} while ($queue);
ksort($list, SORT_NATURAL);
ksort($list, SORT_NATURAL | SORT_FLAG_CASE);
// Update parent timestamps.
foreach (array_reverse($list) as $storage_key => $meta) {

View File

@@ -1983,7 +1983,7 @@ class Pages
$list = $new_list;
// Apply manual ordering to the list.
asort($list);
asort($list, SORT_NUMERIC);
}
foreach ($list as $key => $sort) {