}
$this->availableBoxControllers = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.boxController');
-
- \uasort($this->availableBoxControllers, static function (ObjectType $a, ObjectType $b) {
- return \strcmp(
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \uasort(
+ $this->availableBoxControllers,
+ static fn (ObjectType $a, ObjectType $b) => $collator->compare(
WCF::getLanguage()->get('wcf.acp.box.boxController.' . $a->objectType),
WCF::getLanguage()->get('wcf.acp.box.boxController.' . $b->objectType)
- );
- });
+ )
+ );
$this->readBoxPositions();
}
$this->exporters = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.exporter');
// sort exporters by name
- \uksort($this->exporters, static function ($a, $b) {
- return \strcasecmp(
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \uksort(
+ $this->exporters,
+ static fn (string $a, string $b) => $collator->compare(
WCF::getLanguage()->get('wcf.acp.dataImport.exporter.' . $a),
WCF::getLanguage()->get('wcf.acp.dataImport.exporter.' . $b)
- );
- });
+ )
+ );
$this->importers = \array_keys(ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.importer'));
parent::assignVariables();
$packages = PackageCache::getInstance()->getPackages();
- \usort($packages, static function (Package $a, Package $b) {
- return $a->getName() <=> $b->getName();
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \usort(
+ $packages,
+ static fn (Package $a, Package $b) => $collator->compare($a->getName(), $b->getName())
+ );
WCF::getTPL()->assign([
'languageID' => $this->languageID,
parent::assignVariables();
$packages = PackageCache::getInstance()->getPackages();
- \usort($packages, static function (Package $a, Package $b) {
- return $a->getName() <=> $b->getName();
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \usort(
+ $packages,
+ static fn (Package $a, Package $b) => $collator->compare($a->getName(), $b->getName())
+ );
WCF::getTPL()->assign([
'languages' => $this->languages,
$package->getName();
}
- \uasort($this->availableApplications, static function (Package $a, Package $b) {
- return $a->getName() <=> $b->getName();
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \uasort(
+ $this->availableApplications,
+ static fn (Package $a, Package $b) => $collator->compare($a->getName(), $b->getName())
+ );
}
/**
use wcf\data\user\UserProfile;
use wcf\data\user\UserProfileList;
use wcf\http\Helper;
+use wcf\system\WCF;
/**
* Suggests users that may be mentioned.
return \str_starts_with(\mb_strtolower($userGroup->getName()), $query);
});
- \usort($userGroups, static function (UserGroup $a, UserGroup $b) {
- return \mb_strtolower($a->getName()) <=> \mb_strtolower($b->getName());
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \usort(
+ $userGroups,
+ static fn (UserGroup $a, UserGroup $b) => $collator->compare($a->getName(), $b->getName())
+ );
return $userGroups;
}
}
}
- \usort($list, static function (array $item1, array $item2) {
- return \strcasecmp($item1['label'], $item2['label']);
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \usort(
+ $list,
+ static fn (array $item1, array $item2) => $collator->compare($item1['label'], $item2['label'])
+ );
}
// find users
*/
public static function sortGroups(array &$userGroups)
{
- \uasort($userGroups, static function (self $groupA, self $groupB) {
- return \strcasecmp($groupA->getName(), $groupB->getName());
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \uasort(
+ $userGroups,
+ static fn (self $groupA, self $groupB) => $collator->compare($groupA->getName(), $groupB->getName())
+ );
}
}
$trophyList->readObjects();
$this->trophies = $trophyList->getObjects();
- \uasort($this->trophies, static function (Trophy $a, Trophy $b) {
- return \strcmp($a->getTitle(), $b->getTitle());
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \uasort(
+ $this->trophies,
+ static fn (Trophy $a, Trophy $b) => $collator->compare($a->getTitle(), $b->getTitle())
+ );
}
return $this->trophies;
*/
public function sort(): void
{
- \usort($this->results, static function (ACPSearchResult $a, ACPSearchResult $b) {
- return \strcmp($a->getTitle(), $b->getTitle());
- });
+ $collator = new \Collator(WCF::getLanguage()->getLocale());
+ \usort(
+ $this->results,
+ static fn (ACPSearchResult $a, ACPSearchResult $b) => $collator->compare($a->getTitle(), $b->getTitle())
+ );
}
/**