diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php
index 20e3981ce..a38386d5b 100644
--- a/plugins/af_psql_trgm/init.php
+++ b/plugins/af_psql_trgm/init.php
@@ -3,6 +3,8 @@ class Af_Psql_Trgm extends Plugin {
/* @var PluginHost $host */
private $host;
+ private $default_similarity = 0.75;
+ private $default_min_length = 32;
function about() {
return array(1.0,
@@ -37,7 +39,6 @@ class Af_Psql_Trgm extends Plugin {
$host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
$host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
-
}
function get_js() {
@@ -124,7 +125,7 @@ class Af_Psql_Trgm extends Plugin {
if ($args != "prefFeeds") return;
print "
extension ".__('Mark similar articles as read')."\">";
+ title=\"extension ".__('Mark similar articles as read (af_psql_trgm)')."\">";
if (DB_TYPE != "pgsql") {
print_error("Database type not supported.");
@@ -132,17 +133,14 @@ class Af_Psql_Trgm extends Plugin {
$res = $this->pdo->query("select 'similarity'::regproc");
- if (!$res->fetch()) {
+ if (!$res || !$res->fetch()) {
print_error("pg_trgm extension not found.");
}
- $similarity = $this->host->get($this, "similarity");
- $min_title_length = $this->host->get($this, "min_title_length");
+ $similarity = $this->host->get($this, "similarity", $this->default_similarity);
+ $min_title_length = $this->host->get($this, "min_title_length", $this->default_min_length);
$enable_globally = $this->host->get($this, "enable_globally");
- if (!$similarity) $similarity = '0.75';
- if (!$min_title_length) $min_title_length = '32';
-
print "