mirror of
https://github.com/getgrav/grav.git
synced 2026-07-15 22:03:28 +02:00
Fixed Flex ordering to be natural and case insensitive
This commit is contained in:
@@ -44,6 +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)
|
||||
|
||||
# v1.7.0-rc.17
|
||||
## 10/07/2020
|
||||
|
||||
@@ -144,9 +144,7 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface
|
||||
$matching = array_filter($matching);
|
||||
|
||||
if ($matching) {
|
||||
uksort($matching, static function ($a, $b) {
|
||||
return -($a <=> $b);
|
||||
});
|
||||
arsort($matching, SORT_NUMERIC);
|
||||
}
|
||||
|
||||
return $this->select(array_keys($matching));
|
||||
|
||||
@@ -389,9 +389,9 @@ class FlexIndex extends ObjectIndex implements FlexCollectionInterface, FlexInde
|
||||
|
||||
// Order by current field.
|
||||
if (strtoupper($ordering) === 'DESC') {
|
||||
arsort($search, SORT_NATURAL);
|
||||
arsort($search, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
} else {
|
||||
asort($search, SORT_NATURAL);
|
||||
asort($search, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
}
|
||||
|
||||
$previous = $search;
|
||||
@@ -738,7 +738,7 @@ class FlexIndex extends ObjectIndex implements FlexCollectionInterface, FlexInde
|
||||
}
|
||||
|
||||
// Sort the index before saving it.
|
||||
ksort($index, SORT_NATURAL);
|
||||
ksort($index, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
|
||||
static::onChanges($index, $added, $updated, $removed);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class FileStorage extends FolderStorage
|
||||
$list[$key] = $this->getObjectMeta($key);
|
||||
}
|
||||
|
||||
ksort($list, SORT_NATURAL);
|
||||
ksort($list, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ class FolderStorage extends AbstractFilesystemStorage
|
||||
$list = $this->buildIndexFromFilesystem($path);
|
||||
}
|
||||
|
||||
ksort($list, SORT_NATURAL);
|
||||
ksort($list, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user