Reimplementation of strcasecmp()
Reimplementation of strcasecmp() using collator. It uses the same implementation already made for strcmp(). Fix of menuSort() function in "Ui/Admin.php". Screens fixed: - Administration
This commit is contained in:
parent
5f109073e5
commit
49097b7b07
|
@ -159,7 +159,7 @@ class Admin extends Ui {
|
|||
* @return int
|
||||
*/
|
||||
protected function menuSort($a, $b) {
|
||||
$strcmp = strcasecmp($a['prompt'], $b['prompt']);
|
||||
$strcmp = strcompare($a['prompt'], $b['prompt']);
|
||||
if($strcmp != 0) return $strcmp;
|
||||
if($a['sort'] === $b['sort']) return 0;
|
||||
return ($a['sort'] < $b['sort']) ? -1 : 1;
|
||||
|
|
|
@ -70,14 +70,15 @@ function natural_sort(&$files_or_dirs){
|
|||
}
|
||||
|
||||
/**
|
||||
* Replacement for strcmp() in fulltext.php, line 373.
|
||||
* Replacement for strcmp() in fulltext.php, line 373, where all strings are lowercase.
|
||||
* Replacement for strcasecmp() in Ui/Admin.php, line 162.
|
||||
*/
|
||||
function strcompare($first, $second){
|
||||
global $collator;
|
||||
_init_collator();
|
||||
|
||||
if(!isset($collator))
|
||||
return strcmp($first, $second);
|
||||
return strcasecmp($first, $second);
|
||||
else
|
||||
return $collator->compare($first, $second);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue