diff options
author | Andrew Dolgov <[email protected]> | 2015-07-13 12:46:05 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-07-13 12:46:05 +0300 |
commit | 4f9a3c0e0f995b5ad8eed5357df3d12beb8bee00 (patch) | |
tree | 43b8e2eb0757095b80ed877ae1c379b7f0463f2e /plugins | |
parent | c939dfc39645f6fd687dd926c50286eda4b2c2df (diff) | |
parent | 402073d6a1845f5874da67aa055e733cd2ae693a (diff) |
Merge branch 'master' of git.fakecake.org:tt-rss
Conflicts:
classes/pref/filters.php
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/af_redditimgur/init.php | 52 | ||||
-rw-r--r-- | plugins/vf_shared/init.php | 19 |
2 files changed, 31 insertions, 40 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 6f2c7ff98..2b71a8e9d 100644 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -80,6 +80,10 @@ class Af_RedditImgur extends Plugin { $matches = array(); + if (preg_match("/\.gfycat.com\/([a-z]+)?(\.[a-z]+)$/i", $entry->getAttribute("href"), $matches)) { + $entry->setAttribute("href", "http://www.gfycat.com/".$matches[1]); + } + if (preg_match("/https?:\/\/(www\.)?gfycat.com\/([a-z]+)$/i", $entry->getAttribute("href"), $matches)) { $tmp = fetch_file_contents($entry->getAttribute("href")); @@ -112,6 +116,12 @@ class Af_RedditImgur extends Plugin { } + // imgur .gif -> .gifv + if (preg_match("/i\.imgur\.com\/(.*?)\.gif$/i", $entry->getAttribute("href"))) { + $entry->setAttribute("href", + str_replace(".gif", ".gifv", $entry->getAttribute("href"))); + } + if (preg_match("/\.(gifv)$/i", $entry->getAttribute("href"))) { $source_stream = str_replace(".gifv", ".mp4", $entry->getAttribute("href")); @@ -159,44 +169,10 @@ class Af_RedditImgur extends Plugin { $found = true; } - // links to imgur pages - $matches = array(); - if (preg_match("/^https?:\/\/(m\.)?imgur.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches)) { - - $token = $matches[2]; - - $album_content = fetch_file_contents($entry->getAttribute("href"), - false, false, false, false, 10); - - if ($album_content && $token) { - $adoc = new DOMDocument(); - @$adoc->loadHTML($album_content); - - if ($adoc) { - $axpath = new DOMXPath($adoc); - $aentries = $axpath->query('(//img[@src])'); - - foreach ($aentries as $aentry) { - if (preg_match("/\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) { - $img = $doc->createElement('img'); - $img->setAttribute("src", $aentry->getAttribute("src")); - - $br = $doc->createElement('br'); - - $entry->parentNode->insertBefore($img, $entry); - $entry->parentNode->insertBefore($br, $entry); - - $found = true; - - break; - } - } - } - } - } + // linked albums & pages - // linked albums, ffs - if (preg_match("/^https?:\/\/imgur.com\/(a|album|gallery)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) { + if (preg_match("/^https?:\/\/(m\.)?imgur.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches) || + preg_match("/^https?:\/\/imgur.com\/(a|album|gallery)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) { $album_content = fetch_file_contents($entry->getAttribute("href"), false, false, false, false, 10); @@ -214,7 +190,7 @@ class Af_RedditImgur extends Plugin { if (!in_array($aentry->getAttribute("content"), $urls)) { $img = $doc->createElement('img'); - $img->setAttribute("src", $aentry->getAttribute("content")); + $img->setAttribute("src", str_replace("?fb", "", $aentry->getAttribute("content"))); $entry->parentNode->insertBefore($doc->createElement('br'), $entry); $br = $doc->createElement('br'); diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php index c7eac9659..3138c8a7d 100644 --- a/plugins/vf_shared/init.php +++ b/plugins/vf_shared/init.php @@ -35,7 +35,7 @@ class VF_Shared extends Plugin { //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) { function get_headlines($feed_id, $options) { - $qfh_ret = queryFeedHeadlines(-4, + /*$qfh_ret = queryFeedHeadlines(-4, $options['limit'], $this->get_unread(-1) > 0 ? "adaptive" : "all_articles", false, @@ -49,8 +49,23 @@ class VF_Shared extends Plugin { $options['include_children'], false, "uuid != ''", - "ttrss_feeds.title AS feed_title,"); + "ttrss_feeds.title AS feed_title,"); */ + $params = array( + "feed" => -4, + "limit" => $options["limit"], + "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles", + "search" => $options['search'], + "override_order" => $options['override_order'], + "offset" => $options["offset"], + "filter" => $options["filter"], + "since_id" => $options["since_id"], + "include_children" => $options["include_children"], + "override_strategy" => "uuid != ''", + "override_vfeed" => "ttrss_feeds.title AS feed_title," + ); + + $qfh_ret = queryFeedHeadlines($params); $qfh_ret[1] = __("Shared articles"); return $qfh_ret; |