]> git.wh0rd.org - tt-rss.git/blob - plugins/vf_shared/init.php
9caf1093e875badcaa0031b267d162244b4e15a4
[tt-rss.git] / plugins / vf_shared / init.php
1 <?php
2 class VF_Shared extends Plugin {
3
4 private $host;
5
6 function about() {
7 return array(1.0,
8 "Feed for all articles actively shared by URL",
9 "fox",
10 false);
11 }
12
13 function init($host) {
14 $this->host = $host;
15
16 $host->add_feed(-1, __("Shared articles"), 'plugins/vf_shared/share.png', $this);
17 }
18
19 function api_version() {
20 return 2;
21 }
22
23 /**
24 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
25 */
26 function get_unread($feed_id) {
27 $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
28
29 return db_fetch_result($result, 0, "count");
30 }
31
32 /**
33 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
34 */
35 function get_total($feed_id) {
36 $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
37
38 return db_fetch_result($result, 0, "count");
39 }
40
41 //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
42
43 /**
44 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
45 */
46 function get_headlines($feed_id, $options) {
47 /*$qfh_ret = queryFeedHeadlines(-4,
48 $options['limit'],
49 $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
50 false,
51 $options['search'],
52 $options['search_mode'],
53 $options['override_order'],
54 $options['offset'],
55 $options['owner_uid'],
56 $options['filter'],
57 $options['since_id'],
58 $options['include_children'],
59 false,
60 "uuid != ''",
61 "ttrss_feeds.title AS feed_title,"); */
62
63 $params = array(
64 "feed" => -4,
65 "limit" => $options["limit"],
66 "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
67 "search" => $options['search'],
68 "override_order" => $options['override_order'],
69 "offset" => $options["offset"],
70 "filter" => $options["filter"],
71 "since_id" => $options["since_id"],
72 "include_children" => $options["include_children"],
73 "override_strategy" => "uuid != ''",
74 "override_vfeed" => "ttrss_feeds.title AS feed_title,"
75 );
76
77 $qfh_ret = queryFeedHeadlines($params);
78 $qfh_ret[1] = __("Shared articles");
79
80 return $qfh_ret;
81 }
82
83 }