]> git.wh0rd.org - tt-rss.git/blob - plugins/vf_shared/init.php
ce18f92d50f9ec6e18a74fe153a2fcc178f6cbe5
[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 /**
42 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
43 */
44 function get_headlines($feed_id, $options) {
45 $params = array(
46 "feed" => -4,
47 "limit" => $options["limit"],
48 "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
49 "search" => $options['search'],
50 "override_order" => $options['override_order'],
51 "offset" => $options["offset"],
52 "filter" => $options["filter"],
53 "since_id" => $options["since_id"],
54 "include_children" => $options["include_children"],
55 "override_strategy" => "uuid != ''",
56 "override_vfeed" => "ttrss_feeds.title AS feed_title,"
57 );
58
59 $qfh_ret = Feeds::queryFeedHeadlines($params);
60 $qfh_ret[1] = __("Shared articles");
61
62 return $qfh_ret;
63 }
64
65 }