@@ -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 | } |
@@ -1,29 +1,29 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Af_Comics_Twp extends Af_ComicFilter { |
| 3 | 3 | |
| 4 | - public function supported() { |
|
| 5 | - return array("Three Word Phrase"); |
|
| 6 | - } |
|
| 4 | + public function supported() { |
|
| 5 | + return array("Three Word Phrase"); |
|
| 6 | + } |
|
| 7 | 7 | |
| 8 | - public function process(&$article) { |
|
| 8 | + public function process(&$article) { |
|
| 9 | 9 | |
| 10 | - if (strpos($article["link"], "threewordphrase.com") !== false) { |
|
| 10 | + if (strpos($article["link"], "threewordphrase.com") !== false) { |
|
| 11 | 11 | |
| 12 | - $doc = new DOMDocument(); |
|
| 12 | + $doc = new DOMDocument(); |
|
| 13 | 13 | |
| 14 | - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { |
|
| 15 | - $xpath = new DOMXpath($doc); |
|
| 14 | + if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { |
|
| 15 | + $xpath = new DOMXpath($doc); |
|
| 16 | 16 | |
| 17 | - $basenode = $xpath->query("//td/center/img")->item(0); |
|
| 17 | + $basenode = $xpath->query("//td/center/img")->item(0); |
|
| 18 | 18 | |
| 19 | - if ($basenode) { |
|
| 20 | - $article["content"] = $doc->saveHTML($basenode); |
|
| 21 | - } |
|
| 22 | - } |
|
| 19 | + if ($basenode) { |
|
| 20 | + $article["content"] = $doc->saveHTML($basenode); |
|
| 21 | + } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - return true; |
|
| 25 | - } |
|
| 24 | + return true; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return false; |
|
| 28 | - } |
|
| 27 | + return false; |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -1,28 +1,28 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Af_Comics_Explosm extends Af_ComicFilter { |
| 3 | 3 | |
| 4 | - public function supported() { |
|
| 5 | - return array("Cyanide and Happiness"); |
|
| 6 | - } |
|
| 4 | + public function supported() { |
|
| 5 | + return array("Cyanide and Happiness"); |
|
| 6 | + } |
|
| 7 | 7 | |
| 8 | - public function process(&$article) { |
|
| 8 | + public function process(&$article) { |
|
| 9 | 9 | |
| 10 | - if (strpos($article["link"], "explosm.net/comics") !== false) { |
|
| 10 | + if (strpos($article["link"], "explosm.net/comics") !== false) { |
|
| 11 | 11 | |
| 12 | - $doc = new DOMDocument(); |
|
| 12 | + $doc = new DOMDocument(); |
|
| 13 | 13 | |
| 14 | - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { |
|
| 15 | - $xpath = new DOMXPath($doc); |
|
| 16 | - $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0); |
|
| 14 | + if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { |
|
| 15 | + $xpath = new DOMXPath($doc); |
|
| 16 | + $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0); |
|
| 17 | 17 | |
| 18 | - if ($basenode) { |
|
| 19 | - $article["content"] = $doc->saveHTML($basenode); |
|
| 20 | - } |
|
| 21 | - } |
|
| 18 | + if ($basenode) { |
|
| 19 | + $article["content"] = $doc->saveHTML($basenode); |
|
| 20 | + } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - return true; |
|
| 24 | - } |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return false; |
|
| 27 | - } |
|
| 26 | + return false; |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -1,34 +1,34 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Af_Comics_ComicClass extends Af_ComicFilter { |
| 3 | 3 | |
| 4 | - public function supported() { |
|
| 5 | - return array("Loading Artist"); |
|
| 6 | - } |
|
| 4 | + public function supported() { |
|
| 5 | + return array("Loading Artist"); |
|
| 6 | + } |
|
| 7 | 7 | |
| 8 | - public function process(&$article) { |
|
| 9 | - if (strpos($article["guid"], "loadingartist.com") !== false) { |
|
| 8 | + public function process(&$article) { |
|
| 9 | + if (strpos($article["guid"], "loadingartist.com") !== false) { |
|
| 10 | 10 | |
| 11 | - // lol at people who block clients by user agent |
|
| 12 | - // oh noes my ad revenue Q_Q |
|
| 11 | + // lol at people who block clients by user agent |
|
| 12 | + // oh noes my ad revenue Q_Q |
|
| 13 | 13 | |
| 14 | - $res = fetch_file_contents($article["link"], false, false, false, |
|
| 15 | - false, false, 0, |
|
| 16 | - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); |
|
| 14 | + $res = fetch_file_contents($article["link"], false, false, false, |
|
| 15 | + false, false, 0, |
|
| 16 | + "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); |
|
| 17 | 17 | |
| 18 | - $doc = new DOMDocument(); |
|
| 18 | + $doc = new DOMDocument(); |
|
| 19 | 19 | |
| 20 | - if (@$doc->loadHTML($res)) { |
|
| 21 | - $xpath = new DOMXPath($doc); |
|
| 22 | - $basenode = $xpath->query('//div[@class="comic"]')->item(0); |
|
| 20 | + if (@$doc->loadHTML($res)) { |
|
| 21 | + $xpath = new DOMXPath($doc); |
|
| 22 | + $basenode = $xpath->query('//div[@class="comic"]')->item(0); |
|
| 23 | 23 | |
| 24 | - if ($basenode) { |
|
| 25 | - $article["content"] = $doc->saveHTML($basenode); |
|
| 26 | - } |
|
| 27 | - } |
|
| 24 | + if ($basenode) { |
|
| 25 | + $article["content"] = $doc->saveHTML($basenode); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - return true; |
|
| 30 | - } |
|
| 29 | + return true; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - return false; |
|
| 33 | - } |
|
| 32 | + return false; |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Af_Comics_Pvp extends Af_ComicFilter { |
| 3 | 3 | |
| 4 | - public function supported() { |
|
| 5 | - return array("PvP Online"); |
|
| 6 | - } |
|
| 4 | + public function supported() { |
|
| 5 | + return array("PvP Online"); |
|
| 6 | + } |
|
| 7 | 7 | |
| 8 | - public function process(&$article) { |
|
| 9 | - if (strpos($article["guid"], "pvponline.com") !== false) { |
|
| 8 | + public function process(&$article) { |
|
| 9 | + if (strpos($article["guid"], "pvponline.com") !== false) { |
|
| 10 | 10 | |
| 11 | - $res = fetch_file_contents($article["link"], false, false, false, |
|
| 12 | - false, false, 0, |
|
| 13 | - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); |
|
| 11 | + $res = fetch_file_contents($article["link"], false, false, false, |
|
| 12 | + false, false, 0, |
|
| 13 | + "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); |
|
| 14 | 14 | |
| 15 | - $doc = new DOMDocument(); |
|
| 15 | + $doc = new DOMDocument(); |
|
| 16 | 16 | |
| 17 | - if (@$doc->loadHTML($res)) { |
|
| 18 | - $xpath = new DOMXPath($doc); |
|
| 19 | - $basenode = $xpath->query('//section[@class="comic-art"]')->item(0); |
|
| 17 | + if (@$doc->loadHTML($res)) { |
|
| 18 | + $xpath = new DOMXPath($doc); |
|
| 19 | + $basenode = $xpath->query('//section[@class="comic-art"]')->item(0); |
|
| 20 | 20 | |
| 21 | - if ($basenode) { |
|
| 22 | - $article["content"] = $doc->saveHTML($basenode); |
|
| 23 | - } |
|
| 24 | - } |
|
| 21 | + if ($basenode) { |
|
| 22 | + $article["content"] = $doc->saveHTML($basenode); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return true; |
|
| 27 | - } |
|
| 26 | + return true; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - return false; |
|
| 30 | - } |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 31 | 31 | } |