Compare commits
2 Commits
9113cad57e
...
a1e6d7773b
Author | SHA1 | Date | |
---|---|---|---|
a1e6d7773b | |||
d35e3ed003 |
|
@ -29,8 +29,14 @@ final class MD_STD_SORT {
|
||||||
if ($a[$nameIndex] === $searchValue) return -1;
|
if ($a[$nameIndex] === $searchValue) return -1;
|
||||||
if ($b[$nameIndex] === $searchValue) return 1;
|
if ($b[$nameIndex] === $searchValue) return 1;
|
||||||
|
|
||||||
if (stripos($a[$nameIndex], $searchValue) !== false) return -1;
|
$containsSearchA = stripos($a[$nameIndex], $searchValue);
|
||||||
if (stripos($b[$nameIndex], $searchValue) !== false) return 1;
|
$containsSearchB = stripos($b[$nameIndex], $searchValue);
|
||||||
|
|
||||||
|
if ($containsSearchA !== false and $containsSearchB !== false) {
|
||||||
|
return $a[$sortIndex] > $b[$sortIndex] ? -1 : 1;
|
||||||
|
}
|
||||||
|
if ($containsSearchA !== false) return -1;
|
||||||
|
if ($containsSearchB !== false) return 1;
|
||||||
|
|
||||||
return $a[$sortIndex] > $b[$sortIndex] ? -1 : 1;
|
return $a[$sortIndex] > $b[$sortIndex] ? -1 : 1;
|
||||||
};
|
};
|
||||||
|
@ -62,8 +68,14 @@ final class MD_STD_SORT {
|
||||||
if ($a[$nameIndex] === $searchValue) return -1;
|
if ($a[$nameIndex] === $searchValue) return -1;
|
||||||
if ($b[$nameIndex] === $searchValue) return 1;
|
if ($b[$nameIndex] === $searchValue) return 1;
|
||||||
|
|
||||||
if (stripos($a[$nameIndex], $searchValue) !== false) return -1;
|
$containsSearchA = stripos($a[$nameIndex], $searchValue);
|
||||||
if (stripos($b[$nameIndex], $searchValue) !== false) return 1;
|
$containsSearchB = stripos($b[$nameIndex], $searchValue);
|
||||||
|
|
||||||
|
if ($containsSearchA !== false and $containsSearchB !== false) {
|
||||||
|
return $extSortBy[$a[$sortIndex]] > $extSortBy[$b[$sortIndex]] ? -1 : 1;
|
||||||
|
}
|
||||||
|
if ($containsSearchA !== false) return -1;
|
||||||
|
if ($containsSearchB !== false) return 1;
|
||||||
|
|
||||||
return $extSortBy[$a[$sortIndex]] > $extSortBy[$b[$sortIndex]] ? -1 : 1;
|
return $extSortBy[$a[$sortIndex]] > $extSortBy[$b[$sortIndex]] ? -1 : 1;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user