summaryrefslogtreecommitdiff
path: root/app/Models/UserQuery.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/UserQuery.php')
-rw-r--r--app/Models/UserQuery.php26
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() {