$enable_readability = $this->host->get($this, "enable_readability");
$enable_readability_checked = $enable_readability ? "checked" : "";
- $enable_dupecheck = $this->host->get($this, "enable_dupecheck");
- $enable_dupecheck_checked = $enable_dupecheck ? "checked" : "";
-
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_redditimgur\">";
- print "<h3>" . __("Global settings") . "</h3>";
-
- print_notice("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
+ print "<p>" . __("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
print "<p/>";
print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_readability\"
print "<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
- print "<br/>";
-
- print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_dupecheck\"
- $enable_dupecheck_checked name=\"enable_dupecheck\"> ";
-
- print "<label for=\"enable_dupecheck\">" . __("Mark duplicates as read using content links") . "</label>";
-
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
__("Save")."</button>";
function save() {
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
- $enable_dupecheck = checkbox_to_sql_bool($_POST["enable_dupecheck"]) == "true";
-
+
$this->host->set($this, "enable_readability", $enable_readability);
- $this->host->set($this, "enable_dupecheck", $enable_dupecheck);
echo __("Configuration saved");
}
if ($tmpdoc) {
$tmpxpath = new DOMXPath($tmpdoc);
- $source_meta = $tmpxpath->query("//meta[@property='og:video']")->item(0);
+ $source_meta = $tmpxpath->query("//meta[@name='twitter:player:stream' and contains(@content, '.mp4')]")->item(0);
$poster_meta = $tmpxpath->query("//meta[@property='og:image' and contains(@content,'thumbs.gfycat.com')]")->item(0);
if ($source_meta) {
foreach ($aentries as $aentry) {
$url = str_replace("?fb", "", $aentry->getAttribute("content"));
+ $check_url = basename($url);
+ $check_url = mb_substr($check_url, 0, strrpos($check_url, "."));
- if (!in_array($url, $urls)) {
+ if (!in_array($check_url, $urls)) {
$img = $doc->createElement('img');
$img->setAttribute("src", $url);
$entry->parentNode->insertBefore($doc->createElement('br'), $entry);
$entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry);
- array_push($urls, $url);
+ array_push($urls, $check_url);
$found = true;
}
$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
- if ($content_link && $this->host->get($this, "enable_dupecheck")) {
-
- if (DB_TYPE == "pgsql") {
- $date_qpart = "date_entered < NOW() - INTERVAL '1 day' ";
- } else {
- $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) ";
- }
-
- $content_href = db_escape_string($content_link->getAttribute("href"));
- $owner_uid = $article["owner_uid"];
- $guid = db_escape_string($article["guid_hashed"]);
-
- $result = db_query("SELECT id FROM ttrss_entries, ttrss_user_entries
- WHERE
- content LIKE '%$content_href%' AND
- $date_qpart AND
- ref_id = id AND
- owner_uid = $owner_uid
- AND guid != '$guid'
- LIMIT 1");
-
- if (db_num_rows($result) != 0) {
- $found = true;
- $article["force_catchup"] = true;
- }
- }
-
- if (!$found) $found = $this->inline_stuff($article, $doc, $xpath);
+ $found = $this->inline_stuff($article, $doc, $xpath);
if (function_exists("curl_init") && !$found && $this->host->get($this, "enable_readability") &&
mb_strlen(strip_tags($article["content"])) <= 150) {
$tmp = fetch_file_contents($content_link->getAttribute("href"));
- if ($tmp) {
+ //_debug("tmplen: " . mb_strlen($tmp));
+
+ if ($tmp && mb_strlen($tmp) < 65535 * 4) {
+
$r = new Readability($tmp, $content_link->getAttribute("href"));
if ($r->init()) {