]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/FeedBuilder.php
Refactor filter in LinkDB
[github/shaarli/Shaarli.git] / application / FeedBuilder.php
index 50e0983152484a3e9fc53d06dd15f62debe60b7e..ddefe6ce93a83ed8f6869d1eee57941264731e72 100644 (file)
@@ -103,23 +103,7 @@ class FeedBuilder
     public function buildData()
     {
         // Optionally filter the results:
-        $searchtags = !empty($this->userInput['searchtags']) ? escape($this->userInput['searchtags']) : '';
-        $searchterm = !empty($this->userInput['searchterm']) ? escape($this->userInput['searchterm']) : '';
-        if (! empty($searchtags) && ! empty($searchterm)) {
-            $linksToDisplay = $this->linkDB->filter(
-                LinkFilter::$FILTER_TAG | LinkFilter::$FILTER_TEXT,
-                array($searchtags, $searchterm)
-            );
-        }
-        elseif ($searchtags) {
-            $linksToDisplay = $this->linkDB->filter(LinkFilter::$FILTER_TAG, $searchtags);
-        }
-        elseif ($searchterm) {
-            $linksToDisplay = $this->linkDB->filter(LinkFilter::$FILTER_TEXT, $searchterm);
-        }
-        else {
-            $linksToDisplay = $this->linkDB;
-        }
+        $linksToDisplay = $this->linkDB->filterSearch($this->userInput);
 
         $nblinksToDisplay = $this->getNbLinks(count($linksToDisplay));