VF_Shared::about()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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) {
0 ignored issues
show
Unused Code introduced by
The parameter $feed_id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
    public function get_unread(/** @scrutinizer ignore-unused */ $feed_id) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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) {
0 ignored issues
show
Unused Code introduced by
The parameter $feed_id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

42
    public function get_total(/** @scrutinizer ignore-unused */ $feed_id) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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) {
0 ignored issues
show
Unused Code introduced by
The parameter $feed_id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

57
    public function get_headlines(/** @scrutinizer ignore-unused */ $feed_id, $options) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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