diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-05-22 22:44:38 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-10-06 12:55:05 +0200 |
commit | 4154c25b5f2f8044a37d7f84e04173bb54f2375b (patch) | |
tree | e7f61835072a54eee8590286496bdbbbef0e4a37 /application/LinkDB.php | |
parent | 10a7b5cee96a742fbe86edbea977f3c55c92e9aa (diff) | |
download | Shaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.tar.gz Shaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.tar.zst Shaarli-4154c25b5f2f8044a37d7f84e04173bb54f2375b.zip |
Add a button to set links as sticky
Meaning that they always appear on top of all links
Fixes #186
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index cd0f2967..cdd68cfb 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -537,6 +537,9 @@ You use the community supported version of the original Shaarli project, by Seba | |||
537 | $order = $order === 'ASC' ? -1 : 1; | 537 | $order = $order === 'ASC' ? -1 : 1; |
538 | // Reorder array by dates. | 538 | // Reorder array by dates. |
539 | usort($this->links, function($a, $b) use ($order) { | 539 | usort($this->links, function($a, $b) use ($order) { |
540 | if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { | ||
541 | return $a['sticky'] ? -1 : 1; | ||
542 | } | ||
540 | return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; | 543 | return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; |
541 | }); | 544 | }); |
542 | 545 | ||