]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/bookmark/LinkDB.php
Fix a warning if links sticky status isn't set
[github/shaarli/Shaarli.git] / application / bookmark / LinkDB.php
index 3b77422a25672dce722935df120115d2309db935..41d5591fe11a5dcfaf3f0ca796e9436fccf47746 100644 (file)
@@ -6,8 +6,7 @@ use ArrayAccess;
 use Countable;
 use DateTime;
 use Iterator;
-use LinkFilter;
-use LinkNotFoundException;
+use Shaarli\Bookmark\Exception\LinkNotFoundException;
 use Shaarli\Exceptions\IOException;
 use Shaarli\FileUtils;
 
@@ -107,10 +106,10 @@ class LinkDB implements Iterator, Countable, ArrayAccess
      *
      * Checks if the datastore exists; else, attempts to create a dummy one.
      *
-     * @param string $datastore datastore file path.
-     * @param boolean $isLoggedIn is the user logged in?
-     * @param boolean $hidePublicLinks if true all links are private.
-     * @param string $redirector link redirector set in user settings.
+     * @param string  $datastore        datastore file path.
+     * @param boolean $isLoggedIn       is the user logged in?
+     * @param boolean $hidePublicLinks  if true all links are private.
+     * @param string  $redirector       link redirector set in user settings.
      * @param boolean $redirectorEncode Enable urlencode on redirected urls (default: true).
      */
     public function __construct(
@@ -272,7 +271,8 @@ You use the community supported version of the original Shaarli project, by Seba
             ),
             'private' => 0,
             'created' => new DateTime(),
-            'tags' => 'opensource software'
+            'tags' => 'opensource software',
+            'sticky' => false,
         );
         $link['shorturl'] = link_small_hash($link['created'], $link['id']);
         $this->links[1] = $link;
@@ -285,6 +285,7 @@ You use the community supported version of the original Shaarli project, by Seba
             'private' => 1,
             'created' => new DateTime('1 minute ago'),
             'tags' => 'secretstuff',
+            'sticky' => false,
         );
         $link['shorturl'] = link_small_hash($link['created'], $link['id']);
         $this->links[0] = $link;
@@ -336,6 +337,8 @@ You use the community supported version of the original Shaarli project, by Seba
                 $link['real_url'] = $link['url'];
             }
 
+            $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
+
             // To be able to load links before running the update, and prepare the update
             if (!isset($link['created'])) {
                 $link['id'] = $link['linkdate'];
@@ -426,12 +429,12 @@ You use the community supported version of the original Shaarli project, by Seba
     /**
      * Filter links according to search parameters.
      *
-     * @param array $filterRequest Search request content. Supported keys:
+     * @param array  $filterRequest  Search request content. Supported keys:
      *                                - searchtags: list of tags
      *                                - searchterm: term search
-     * @param bool $casesensitive Optional: Perform case sensitive filter
-     * @param string $visibility return only all/private/public links
-     * @param string $untaggedonly return only untagged links
+     * @param bool   $casesensitive  Optional: Perform case sensitive filter
+     * @param string $visibility     return only all/private/public links
+     * @param bool   $untaggedonly   return only untagged links
      *
      * @return array filtered links, all links if no suitable filter was provided.
      */
@@ -457,8 +460,8 @@ You use the community supported version of the original Shaarli project, by Seba
     /**
      * Returns the list tags appearing in the links with the given tags
      *
-     * @param array $filteringTags tags selecting the links to consider
-     * @param string $visibility process only all/private/public links
+     * @param array  $filteringTags tags selecting the links to consider
+     * @param string $visibility    process only all/private/public links
      *
      * @return array tag => linksCount
      */
@@ -500,7 +503,7 @@ You use the community supported version of the original Shaarli project, by Seba
      * Rename or delete a tag across all links.
      *
      * @param string $from Tag to rename
-     * @param string $to New tag. If none is provided, the from tag will be deleted
+     * @param string $to   New tag. If none is provided, the from tag will be deleted
      *
      * @return array|bool List of altered links or false on error
      */