]> git.wh0rd.org - tt-rss.git/blob - plugins/vf_shared/init.php
queryFeedHeadlines: move to array-based arguments, optionally check if first element...
[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 function get_unread($feed_id) {
24 $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
25
26 return db_fetch_result($result, 0, "count");
27 }
28
29 function get_total($feed_id) {
30 $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
31
32 return db_fetch_result($result, 0, "count");
33 }
34
35 //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) {
36
37 function get_headlines($feed_id, $options) {
38 /*$qfh_ret = queryFeedHeadlines(-4,
39 $options['limit'],
40 $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
41 false,
42 $options['search'],
43 $options['search_mode'],
44 $options['override_order'],
45 $options['offset'],
46 $options['owner_uid'],
47 $options['filter'],
48 $options['since_id'],
49 $options['include_children'],
50 false,
51 "uuid != ''",
52 "ttrss_feeds.title AS feed_title,"); */
53
54 $params = array(
55 "feed" => -4,
56 "limit" => $options["limit"],
57 "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
58 "search" => $options['search'],
59 "override_order" => $options['override_order'],
60 "offset" => $options["offset"],
61 "filter" => $options["filter"],
62 "since_id" => $options["since_id"],
63 "include_children" => $options["include_children"],
64 "override_strategy" => "uuid != ''",
65 "override_vfeed" => "ttrss_feeds.title AS feed_title,"
66 );
67
68 $qfh_ret = queryFeedHeadlines($params);
69 $qfh_ret[1] = __("Shared articles");
70
71 return $qfh_ret;
72 }
73
74 }
75 ?>