X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FLinkDB.php;h=1f7c28cd35f1f68444828bd8ba84642c64f7b393;hb=f211e417bf637b8a83988175c29ee072c69f7642;hp=cd0f29671f9b199c213b4333e8eeab23eedcadb7;hpb=f8c5660df82432c7f3bb0686e393db5a2b46eeb5;p=github%2Fshaarli%2FShaarli.git diff --git a/application/LinkDB.php b/application/LinkDB.php index cd0f2967..1f7c28cd 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -107,8 +107,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess $hidePublicLinks, $redirector = '', $redirectorEncode = true - ) - { + ) { $this->datastore = $datastore; $this->loggedIn = $isLoggedIn; $this->hidePublicLinks = $hidePublicLinks; @@ -317,8 +316,7 @@ You use the community supported version of the original Shaarli project, by Seba } else { $link['real_url'] .= $link['url']; } - } - else { + } else { $link['real_url'] = $link['url']; } @@ -403,7 +401,8 @@ You use the community supported version of the original Shaarli project, by Seba * * @return array list of shaare found. */ - public function filterDay($request) { + public function filterDay($request) + { $linkFilter = new LinkFilter($this->links); return $linkFilter->filter(LinkFilter::$FILTER_DAY, $request); } @@ -492,8 +491,7 @@ You use the community supported version of the original Shaarli project, by Seba $delete = empty($to); // True for case-sensitive tag search. $linksToAlter = $this->filterSearch(['searchtags' => $from], true); - foreach($linksToAlter as $key => &$value) - { + foreach ($linksToAlter as $key => &$value) { $tags = preg_split('/\s+/', trim($value['tags'])); if (($pos = array_search($from, $tags)) !== false) { if ($delete) { @@ -536,7 +534,10 @@ You use the community supported version of the original Shaarli project, by Seba { $order = $order === 'ASC' ? -1 : 1; // Reorder array by dates. - usort($this->links, function($a, $b) use ($order) { + usort($this->links, function ($a, $b) use ($order) { + if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { + return $a['sticky'] ? -1 : 1; + } return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; });