]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pluginhost.php
remove firefox feed subscribe integration code (obsolete)
[tt-rss.git] / classes / pluginhost.php
index bff7c32d0b5ea3f69ee145ec06e750fac69b57b6..4eada78b297b3b7c983314101b702b07c7bc254f 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 class PluginHost {
-       private $dbh;
        private $pdo;
        private $hooks = array();
        private $plugins = array();
@@ -57,13 +56,13 @@ class PluginHost {
        const HOOK_FORMAT_ARTICLE_CDM = 35;
        const HOOK_FEED_BASIC_INFO = 36;
        const HOOK_SEND_LOCAL_FILE = 37;
+       const HOOK_UNSUBSCRIBE_FEED = 38;
 
        const KIND_ALL = 1;
        const KIND_SYSTEM = 2;
        const KIND_USER = 3;
 
        function __construct() {
-               $this->dbh = Db::get();
                $this->pdo = Db::pdo();
 
                $this->storage = array();
@@ -91,7 +90,7 @@ class PluginHost {
        }
 
        function get_dbh() {
-               return $this->dbh;
+               return Db::get();
        }
 
        function get_pdo() {
@@ -281,8 +280,6 @@ class PluginHost {
                } else {
                        return false;
                }
-
-               return false;
        }
 
        function get_commands() {
@@ -321,19 +318,18 @@ class PluginHost {
                        if (!isset($this->storage[$plugin]))
                                $this->storage[$plugin] = array();
 
-                       $content = serialize($this->storage[$plugin],
-                               false);
+                       $content = serialize($this->storage[$plugin]);
 
                        if ($sth->fetch()) {
                                $sth = $this->pdo->prepare("UPDATE ttrss_plugin_storage SET content = ?
                                        WHERE owner_uid= ? AND name = ?");
-                               $sth->execute([$content, $this->owner_uid, $plugin]);
+                               $sth->execute([(string)$content, $this->owner_uid, $plugin]);
 
                        } else {
                                $sth = $this->pdo->prepare("INSERT INTO ttrss_plugin_storage
                                        (name,owner_uid,content) VALUES
                                        (?, ?, ?)");
-                               $sth->execute([$plugin, $this->owner_uid, $content]);
+                               $sth->execute([$plugin, $this->owner_uid, (string)$content]);
                        }
 
                        $this->pdo->commit();
@@ -364,7 +360,9 @@ class PluginHost {
        function get_all($sender) {
                $idx = get_class($sender);
 
-               return $this->storage[$idx];
+               $data = $this->storage[$idx];
+
+               return $data ? $data : [];
        }
 
        function clear_data($sender) {