1
|
|
|
<?php |
2
|
|
|
class VF_Shared extends Plugin { |
3
|
|
|
|
4
|
|
|
/* @var PluginHost $host */ |
5
|
|
|
private $host; |
6
|
|
|
|
7
|
|
|
public function about() { |
8
|
|
|
return array(1.0, |
9
|
|
|
"Feed for all articles actively shared by URL", |
10
|
|
|
"fox", |
11
|
|
|
false); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function init($host) { |
15
|
|
|
$this->host = $host; |
16
|
|
|
|
17
|
|
|
$host->add_feed(-1, __("Shared articles"), 'link', $this); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function api_version() { |
21
|
|
|
return 2; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
26
|
|
|
*/ |
27
|
|
|
public function get_unread($feed_id) { |
|
|
|
|
28
|
|
|
$sth = $this->pdo->prepare("select count(int_id) AS count |
29
|
|
|
from ttrss_user_entries where owner_uid = ? and unread = true and uuid != ''"); |
30
|
|
|
$sth->execute([$_SESSION['uid']]); |
31
|
|
|
|
32
|
|
|
if ($row = $sth->fetch()) { |
33
|
|
|
return $row['count']; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
return 0; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
41
|
|
|
*/ |
42
|
|
|
public function get_total($feed_id) { |
|
|
|
|
43
|
|
|
$sth = $this->pdo->prepare("select count(int_id) AS count |
44
|
|
|
from ttrss_user_entries where owner_uid = ? and uuid != ''"); |
45
|
|
|
$sth->execute([$_SESSION['uid']]); |
46
|
|
|
|
47
|
|
|
if ($row = $sth->fetch()) { |
48
|
|
|
return $row['count']; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
return 0; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
56
|
|
|
*/ |
57
|
|
|
public function get_headlines($feed_id, $options) { |
|
|
|
|
58
|
|
|
$params = array( |
59
|
|
|
"feed" => -4, |
60
|
|
|
"limit" => $options["limit"], |
61
|
|
|
"view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles", |
62
|
|
|
"search" => $options['search'], |
63
|
|
|
"override_order" => $options['override_order'], |
64
|
|
|
"offset" => $options["offset"], |
65
|
|
|
"filter" => $options["filter"], |
66
|
|
|
"since_id" => $options["since_id"], |
67
|
|
|
"include_children" => $options["include_children"], |
68
|
|
|
"override_strategy" => "uuid != ''", |
69
|
|
|
"override_vfeed" => "ttrss_feeds.title AS feed_title," |
70
|
|
|
); |
71
|
|
|
|
72
|
|
|
$qfh_ret = Feeds::queryFeedHeadlines($params); |
73
|
|
|
$qfh_ret[1] = __("Shared articles"); |
74
|
|
|
|
75
|
|
|
return $qfh_ret; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.