diff options
| author | 2018-10-28 09:49:10 +0100 | |
|---|---|---|
| committer | 2018-10-28 09:49:10 +0100 | |
| commit | e04804d0f67dd43fd3f072b9a127768ee7b7b56c (patch) | |
| tree | a49023ed25aab7fb1c1aafe749f7d462de0027b2 /app/Models/UserQuery.php | |
| parent | 44bd07e506ade204151c276fdc05994d51efdd7a (diff) | |
| parent | 4234dfe0d72b61fe931d2c76a1d8a335ce65a209 (diff) | |
Merge pull request #2049 from FreshRSS/dev1.12.0
FreshRSS 1.12.0
Diffstat (limited to 'app/Models/UserQuery.php')
| -rw-r--r-- | app/Models/UserQuery.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index ef94fdaf6..f607084f8 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -19,15 +19,17 @@ class FreshRSS_UserQuery { private $url; private $feed_dao; private $category_dao; + private $tag_dao; /** * @param array $query * @param FreshRSS_Searchable $feed_dao * @param FreshRSS_Searchable $category_dao */ - public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null) { + public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null, FreshRSS_Searchable $tag_dao = null) { $this->category_dao = $category_dao; $this->feed_dao = $feed_dao; + $this->tag_dao = $tag_dao; if (isset($query['get'])) { $this->parseGet($query['get']); } @@ -88,6 +90,9 @@ class FreshRSS_UserQuery { case 's': $this->parseFavorite(); break; + case 't': + $this->parseTag($matches['id']); + break; } } } @@ -139,6 +144,25 @@ class FreshRSS_UserQuery { } /** + * Parse the query string when it is a "tag" query + * + * @param integer $id + * @throws FreshRSS_DAO_Exception + */ + private function parseTag($id) { + if ($this->tag_dao == null) { + throw new FreshRSS_DAO_Exception('Tag DAO is not loaded in UserQuery'); + } + $category = $this->category_dao->searchById($id); + if ($tag) { + $this->get_name = $tag->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'tag'; + } + + /** * Parse the query string when it is a "favorite" query */ private function parseFavorite() { |
