Fix natural sort when > 100 pages (#1564)

* Fix natural sort when > 100 pages

* Revert manual and default sort type

* Only check prefix numbers
This commit is contained in:
Djamil Legato
2017-07-11 17:01:13 -07:00
committed by Andy Miller
parent 4332dd07a9
commit 287a51148a

View File

@@ -1257,6 +1257,12 @@ class Pages
$locale = setlocale(LC_COLLATE, 0); //`setlocale` with a 0 param returns the current locale set
$col = Collator::create($locale);
if ($col) {
if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) {
$list = preg_replace_callback('~([0-9]+)\.~', function($number) {
return sprintf('%032d', $number);
}, $list);
}
$col->asort($list, $sort_flags);
} else {
asort($list, $sort_flags);