Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions action/prosemirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public function writeDefaultsToJSINFO(Event $event, $param)
$JSINFO['plugins'] = [];
}
$JSINFO['plugins']['gallery'] = [
'defaults' => array_map(function ($default) {
return ['default' => $default,];
}, $defaults),
'defaults' => array_map(static fn($default) => ['default' => $default,], $defaults),
];
$JSINFO['plugins']['gallery']['defaults']['namespace'] = ['default' => ''];
}
Expand Down
16 changes: 4 additions & 12 deletions classes/AbstractGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,16 @@ public function getImages()

switch ($this->options->sort) {
case Options::SORT_FILE:
usort($images, function ($a, $b) {
return Sort::strcmp($a->getFilename(), $b->getFilename());
});
usort($images, static fn($a, $b) => Sort::strcmp($a->getFilename(), $b->getFilename()));
break;
case Options::SORT_CTIME:
usort($images, function ($a, $b) {
return $a->getCreated() - $b->getCreated();
});
usort($images, static fn($a, $b) => $a->getCreated() - $b->getCreated());
break;
case Options::SORT_MTIME:
usort($images, function ($a, $b) {
return $a->getModified() - $b->getModified();
});
usort($images, static fn($a, $b) => $a->getModified() - $b->getModified());
break;
case Options::SORT_TITLE:
usort($images, function ($a, $b) {
return Sort::strcmp($a->getTitle(), $b->getTitle());
});
usort($images, static fn($a, $b) => Sort::strcmp($a->getTitle(), $b->getTitle()));
break;
case Options::SORT_RANDOM:
shuffle($images);
Expand Down