af_redditimgur: add option for previous

This commit is contained in:
Andrew Dolgov 2016-01-31 14:14:31 +03:00
parent 902b1ac7b5
commit 891b77f90e

View file

@ -27,6 +27,9 @@ class Af_RedditImgur extends Plugin {
$enable_readability = $this->host->get($this, "enable_readability");
$enable_readability_checked = $enable_readability ? "checked" : "";
$enable_content_dupcheck = $this->host->get($this, "enable_content_dupcheck");
$enable_content_dupcheck_checked = $enable_content_dupcheck ? "checked" : "";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
@ -55,6 +58,12 @@ class Af_RedditImgur extends Plugin {
print "<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
print "<br/>";
print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_content_dupcheck\"
$enable_content_dupcheck_checked name=\"enable_content_dupcheck\">&nbsp;";
print "<label for=\"enable_content_dupcheck\">" . __("Enable additional duplicate checking") . "</label>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
__("Save")."</button>";
@ -65,8 +74,10 @@ class Af_RedditImgur extends Plugin {
function save() {
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
$enable_content_dupcheck = checkbox_to_sql_bool($_POST["enable_content_dupcheck"]) == "true";
$this->host->set($this, "enable_readability", $enable_readability);
$this->host->set($this, "enable_readability", $enable_readability, false);
$this->host->set($this, "enable_content_dupcheck", $enable_content_dupcheck);
echo __("Configuration saved");
}
@ -244,7 +255,8 @@ class Af_RedditImgur extends Plugin {
@$doc->loadHTML($article["content"]);
$xpath = new DOMXPath($doc);
/*$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
if ($this->host->get($this, "enable_content_dupcheck")) {
$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
if ($content_link) {
$content_href = db_escape_string($content_link->getAttribute("href"));
@ -270,7 +282,8 @@ class Af_RedditImgur extends Plugin {
if ($num_found > 0) $article["force_catchup"] = true;
}
}*/
}
}
$found = $this->inline_stuff($article, $doc, $xpath);