@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | interface IDb { |
3 | - public function connect($host, $user, $pass, $db, $port); |
|
4 | - public function escape_string($s, $strip_tags = true); |
|
5 | - public function query($query, $die_on_error = true); |
|
6 | - public function fetch_assoc($result); |
|
7 | - public function num_rows($result); |
|
8 | - public function fetch_result($result, $row, $param); |
|
9 | - public function close(); |
|
10 | - public function affected_rows($result); |
|
11 | - public function last_error(); |
|
12 | - public function last_query_error(); |
|
3 | + public function connect($host, $user, $pass, $db, $port); |
|
4 | + public function escape_string($s, $strip_tags = true); |
|
5 | + public function query($query, $die_on_error = true); |
|
6 | + public function fetch_assoc($result); |
|
7 | + public function num_rows($result); |
|
8 | + public function fetch_result($result, $row, $param); |
|
9 | + public function close(); |
|
10 | + public function affected_rows($result); |
|
11 | + public function last_error(); |
|
12 | + public function last_query_error(); |
|
13 | 13 | } |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | class Handler implements IHandler { |
3 | - protected $pdo; |
|
4 | - protected $args; |
|
3 | + protected $pdo; |
|
4 | + protected $args; |
|
5 | 5 | |
6 | - public function __construct($args) { |
|
7 | - $this->pdo = Db::pdo(); |
|
8 | - $this->args = $args; |
|
9 | - } |
|
6 | + public function __construct($args) { |
|
7 | + $this->pdo = Db::pdo(); |
|
8 | + $this->args = $args; |
|
9 | + } |
|
10 | 10 | |
11 | - public function csrf_ignore($method) { |
|
12 | - return true; |
|
13 | - } |
|
11 | + public function csrf_ignore($method) { |
|
12 | + return true; |
|
13 | + } |
|
14 | 14 | |
15 | - public function before($method) { |
|
16 | - return true; |
|
17 | - } |
|
15 | + public function before($method) { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - public function after() { |
|
20 | - return true; |
|
21 | - } |
|
19 | + public function after() { |
|
20 | + return true; |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php |
2 | 2 | class Swap_JK extends Plugin { |
3 | 3 | |
4 | - private $host; |
|
4 | + private $host; |
|
5 | 5 | |
6 | - public function about() { |
|
7 | - return array(1.0, |
|
8 | - "Swap j and k hotkeys (for vi brethren)", |
|
9 | - "fox"); |
|
10 | - } |
|
6 | + public function about() { |
|
7 | + return array(1.0, |
|
8 | + "Swap j and k hotkeys (for vi brethren)", |
|
9 | + "fox"); |
|
10 | + } |
|
11 | 11 | |
12 | - public function init($host) { |
|
13 | - $this->host = $host; |
|
12 | + public function init($host) { |
|
13 | + $this->host = $host; |
|
14 | 14 | |
15 | - $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
16 | - } |
|
15 | + $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
16 | + } |
|
17 | 17 | |
18 | - public function hook_hotkey_map($hotkeys) { |
|
18 | + public function hook_hotkey_map($hotkeys) { |
|
19 | 19 | |
20 | - $hotkeys["j"] = "next_feed"; |
|
21 | - $hotkeys["k"] = "prev_feed"; |
|
20 | + $hotkeys["j"] = "next_feed"; |
|
21 | + $hotkeys["k"] = "prev_feed"; |
|
22 | 22 | |
23 | - return $hotkeys; |
|
24 | - } |
|
23 | + return $hotkeys; |
|
24 | + } |
|
25 | 25 | |
26 | - public function api_version() { |
|
27 | - return 2; |
|
28 | - } |
|
26 | + public function api_version() { |
|
27 | + return 2; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | } |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <?php |
2 | 2 | class Close_Button extends Plugin { |
3 | - private $host; |
|
4 | - |
|
5 | - public function init($host) { |
|
6 | - $this->host = $host; |
|
7 | - |
|
8 | - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); |
|
9 | - } |
|
10 | - |
|
11 | - public function about() { |
|
12 | - return array(1.0, |
|
13 | - "Adds a button to close article panel", |
|
14 | - "fox"); |
|
15 | - } |
|
16 | - |
|
17 | - public function get_css() { |
|
18 | - return "i.icon-close-article { color : red; }"; |
|
19 | - } |
|
20 | - |
|
21 | - /** |
|
22 | - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
23 | - */ |
|
24 | - public function hook_article_button($line) { |
|
25 | - if (!get_pref("COMBINED_DISPLAY_MODE")) { |
|
26 | - $rv = "<i class='material-icons icon-close-article' |
|
3 | + private $host; |
|
4 | + |
|
5 | + public function init($host) { |
|
6 | + $this->host = $host; |
|
7 | + |
|
8 | + $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); |
|
9 | + } |
|
10 | + |
|
11 | + public function about() { |
|
12 | + return array(1.0, |
|
13 | + "Adds a button to close article panel", |
|
14 | + "fox"); |
|
15 | + } |
|
16 | + |
|
17 | + public function get_css() { |
|
18 | + return "i.icon-close-article { color : red; }"; |
|
19 | + } |
|
20 | + |
|
21 | + /** |
|
22 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
23 | + */ |
|
24 | + public function hook_article_button($line) { |
|
25 | + if (!get_pref("COMBINED_DISPLAY_MODE")) { |
|
26 | + $rv = "<i class='material-icons icon-close-article' |
|
27 | 27 | style='cursor : pointer' onclick='Article.close()' |
28 | 28 | title='".__('Close article')."'>close</i>"; |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | - return $rv; |
|
32 | - } |
|
31 | + return $rv; |
|
32 | + } |
|
33 | 33 | |
34 | - public function api_version() { |
|
35 | - return 2; |
|
36 | - } |
|
34 | + public function api_version() { |
|
35 | + return 2; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | } |
@@ -1,78 +1,78 @@ |
||
1 | 1 | <?php |
2 | 2 | class VF_Shared extends Plugin { |
3 | 3 | |
4 | - /* @var PluginHost $host */ |
|
5 | - private $host; |
|
4 | + /* @var PluginHost $host */ |
|
5 | + private $host; |
|
6 | 6 | |
7 | - public function about() { |
|
8 | - return array(1.0, |
|
9 | - "Feed for all articles actively shared by URL", |
|
10 | - "fox", |
|
11 | - false); |
|
12 | - } |
|
7 | + public function about() { |
|
8 | + return array(1.0, |
|
9 | + "Feed for all articles actively shared by URL", |
|
10 | + "fox", |
|
11 | + false); |
|
12 | + } |
|
13 | 13 | |
14 | - public function init($host) { |
|
15 | - $this->host = $host; |
|
14 | + public function init($host) { |
|
15 | + $this->host = $host; |
|
16 | 16 | |
17 | - $host->add_feed(-1, __("Shared articles"), 'link', $this); |
|
18 | - } |
|
17 | + $host->add_feed(-1, __("Shared articles"), 'link', $this); |
|
18 | + } |
|
19 | 19 | |
20 | - public function api_version() { |
|
21 | - return 2; |
|
22 | - } |
|
20 | + public function api_version() { |
|
21 | + return 2; |
|
22 | + } |
|
23 | 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 |
|
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 | 29 | from ttrss_user_entries where owner_uid = ? and unread = true and uuid != ''"); |
30 | - $sth->execute([$_SESSION['uid']]); |
|
30 | + $sth->execute([$_SESSION['uid']]); |
|
31 | 31 | |
32 | - if ($row = $sth->fetch()) { |
|
33 | - return $row['count']; |
|
34 | - } |
|
32 | + if ($row = $sth->fetch()) { |
|
33 | + return $row['count']; |
|
34 | + } |
|
35 | 35 | |
36 | - return 0; |
|
37 | - } |
|
36 | + return 0; |
|
37 | + } |
|
38 | 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 |
|
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 | 44 | from ttrss_user_entries where owner_uid = ? and uuid != ''"); |
45 | - $sth->execute([$_SESSION['uid']]); |
|
45 | + $sth->execute([$_SESSION['uid']]); |
|
46 | 46 | |
47 | - if ($row = $sth->fetch()) { |
|
48 | - return $row['count']; |
|
49 | - } |
|
47 | + if ($row = $sth->fetch()) { |
|
48 | + return $row['count']; |
|
49 | + } |
|
50 | 50 | |
51 | - return 0; |
|
52 | - } |
|
51 | + return 0; |
|
52 | + } |
|
53 | 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 | - ); |
|
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 | 71 | |
72 | - $qfh_ret = Feeds::queryFeedHeadlines($params); |
|
73 | - $qfh_ret[1] = __("Shared articles"); |
|
72 | + $qfh_ret = Feeds::queryFeedHeadlines($params); |
|
73 | + $qfh_ret[1] = __("Shared articles"); |
|
74 | 74 | |
75 | - return $qfh_ret; |
|
76 | - } |
|
75 | + return $qfh_ret; |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | abstract class Af_ComicFilter { |
3 | - public abstract function supported(); |
|
4 | - public abstract function process(&$article); |
|
3 | + public abstract function supported(); |
|
4 | + public abstract function process(&$article); |
|
5 | 5 | } |
6 | 6 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | class Af_Comics_Template extends Af_ComicFilter { |
3 | 3 | |
4 | - public function supported() { |
|
5 | - return array("Example"); |
|
6 | - } |
|
4 | + public function supported() { |
|
5 | + return array("Example"); |
|
6 | + } |
|
7 | 7 | |
8 | - public function process(&$article) { |
|
9 | - //$owner_uid = $article["owner_uid"]; |
|
8 | + public function process(&$article) { |
|
9 | + //$owner_uid = $article["owner_uid"]; |
|
10 | 10 | |
11 | - return false; |
|
12 | - } |
|
11 | + return false; |
|
12 | + } |
|
13 | 13 | } |
@@ -1,31 +1,31 @@ |
||
1 | 1 | <?php |
2 | 2 | class Hotkeys_Noscroll extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "n/p hotkeys move between articles without scrolling", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "n/p hotkeys move between articles without scrolling", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
15 | - } |
|
14 | + $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
15 | + } |
|
16 | 16 | |
17 | - public function hook_hotkey_map($hotkeys) { |
|
17 | + public function hook_hotkey_map($hotkeys) { |
|
18 | 18 | |
19 | - $hotkeys["(40)|Down"] = "next_article_noscroll"; |
|
20 | - $hotkeys["(38)|Up"] = "prev_article_noscroll"; |
|
21 | - $hotkeys["n"] = "next_article_noscroll"; |
|
22 | - $hotkeys["p"] = "prev_article_noscroll"; |
|
19 | + $hotkeys["(40)|Down"] = "next_article_noscroll"; |
|
20 | + $hotkeys["(38)|Up"] = "prev_article_noscroll"; |
|
21 | + $hotkeys["n"] = "next_article_noscroll"; |
|
22 | + $hotkeys["p"] = "prev_article_noscroll"; |
|
23 | 23 | |
24 | - return $hotkeys; |
|
25 | - } |
|
24 | + return $hotkeys; |
|
25 | + } |
|
26 | 26 | |
27 | - public function api_version() { |
|
28 | - return 2; |
|
29 | - } |
|
27 | + public function api_version() { |
|
28 | + return 2; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | } |
@@ -1,47 +1,47 @@ |
||
1 | 1 | <?php |
2 | 2 | class Af_Youtube_Embed extends Plugin { |
3 | - private $host; |
|
3 | + private $host; |
|
4 | 4 | |
5 | - public function about() { |
|
6 | - return array(1.0, |
|
7 | - "Embed videos in Youtube RSS feeds (and whitelist Youtube iframes)", |
|
8 | - "fox"); |
|
9 | - } |
|
5 | + public function about() { |
|
6 | + return array(1.0, |
|
7 | + "Embed videos in Youtube RSS feeds (and whitelist Youtube iframes)", |
|
8 | + "fox"); |
|
9 | + } |
|
10 | 10 | |
11 | - public function init($host) { |
|
12 | - $this->host = $host; |
|
11 | + public function init($host) { |
|
12 | + $this->host = $host; |
|
13 | 13 | |
14 | - $host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this); |
|
15 | - $host->add_hook($host::HOOK_IFRAME_WHITELISTED, $this); |
|
16 | - } |
|
14 | + $host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this); |
|
15 | + $host->add_hook($host::HOOK_IFRAME_WHITELISTED, $this); |
|
16 | + } |
|
17 | 17 | |
18 | - public function hook_iframe_whitelisted($src) { |
|
19 | - return in_array($src, ["www.youtube.com", "youtube.com", "youtu.be"]); |
|
20 | - } |
|
18 | + public function hook_iframe_whitelisted($src) { |
|
19 | + return in_array($src, ["www.youtube.com", "youtube.com", "youtu.be"]); |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
24 | - */ |
|
25 | - public function hook_render_enclosure($entry, $hide_images) { |
|
22 | + /** |
|
23 | + * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
24 | + */ |
|
25 | + public function hook_render_enclosure($entry, $hide_images) { |
|
26 | 26 | |
27 | - $matches = array(); |
|
27 | + $matches = array(); |
|
28 | 28 | |
29 | - if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["url"], $matches) || |
|
30 | - preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["url"], $matches) || |
|
31 | - preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["url"], $matches)) { |
|
29 | + if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["url"], $matches) || |
|
30 | + preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["url"], $matches) || |
|
31 | + preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["url"], $matches)) { |
|
32 | 32 | |
33 | - $vid_id = $matches[1]; |
|
33 | + $vid_id = $matches[1]; |
|
34 | 34 | |
35 | - return "<iframe class=\"youtube-player\" |
|
35 | + return "<iframe class=\"youtube-player\" |
|
36 | 36 | type=\"text/html\" width=\"640\" height=\"385\" |
37 | 37 | src=\"https://www.youtube.com/embed/$vid_id\" |
38 | 38 | allowfullscreen frameborder=\"0\"></iframe>"; |
39 | 39 | |
40 | - } |
|
41 | - } |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - public function api_version() { |
|
44 | - return 2; |
|
45 | - } |
|
43 | + public function api_version() { |
|
44 | + return 2; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |