]> git.wh0rd.org - tt-rss.git/blobdiff - classes/api.php
make pluginhost a singleton
[tt-rss.git] / classes / api.php
index 945496bcfff0c9206430d9e8c2eb2556dfcb22a1..9e99ed007f94147181bc1f63f1f80be3e76ddd4b 100644 (file)
@@ -341,8 +341,7 @@ class API extends Handler {
                                        "score" => (int)$line["score"]
                                );
 
-                               global $pluginhost;
-                               foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE_API) as $p) {
+                               foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
                                        $article = $p->hook_render_article_api(array("article" => $article));
                                }
 
@@ -466,9 +465,7 @@ class API extends Handler {
        }
 
        function index($method) {
-               global $pluginhost;
-
-               $plugin = $pluginhost->get_api_method(strtolower($method));
+               $plugin = PluginHost::getInstance()->get_api_method(strtolower($method));
 
                if ($plugin && method_exists($plugin, $method)) {
                        $reply = $plugin->$method();
@@ -697,8 +694,7 @@ class API extends Handler {
                                $headline_row["author"] = $line["author"];
                                $headline_row["score"] = (int)$line["score"];
 
-                               global $pluginhost;
-                               foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE_API) as $p) {
+                               foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
                                        $headline_row = $p->hook_render_article_api(array("headline" => $headline_row));
                                }