]>
Commit | Line | Data |
---|---|---|
a6a61a8c AD |
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 | ||
21ce7d9e AD |
23 | /** |
24 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) | |
25 | */ | |
a6a61a8c AD |
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 | ||
21ce7d9e AD |
32 | /** |
33 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) | |
34 | */ | |
a6a61a8c AD |
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 | ||
21ce7d9e AD |
41 | /** |
42 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) | |
43 | */ | |
a6a61a8c | 44 | function get_headlines($feed_id, $options) { |
f5a0fb8b AD |
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 | ||
aeb1abed | 59 | $qfh_ret = Feeds::queryFeedHeadlines($params); |
a6a61a8c AD |
60 | $qfh_ret[1] = __("Shared articles"); |
61 | ||
62 | return $qfh_ret; | |
63 | } | |
64 | ||
21ce7d9e | 65 | } |