]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pluginhandler.php
add a wrapper for standard error codes returned by backend, also add explanation...
[tt-rss.git] / classes / pluginhandler.php
index df7058dcd6d4f78241617e277b7aa481b262dd7c..5ca5c17d3d344b6bb5c6dc9a4d75c38b0261e4e9 100644 (file)
@@ -5,12 +5,16 @@ class PluginHandler extends Handler_Protected {
        }
 
        function catchall($method) {
-               global $pluginhost;
+               $plugin = PluginHost::getInstance()->get_plugin($_REQUEST["plugin"]);
 
-               $plugin = $pluginhost->get_plugin($_REQUEST["plugin"]);
-
-               if (method_exists($plugin, $method)) {
-                       $plugin->$method();
+               if ($plugin) {
+                       if (method_exists($plugin, $method)) {
+                               $plugin->$method();
+                       } else {
+                               print error_json(13);
+                       }
+               } else {
+                       print error_json(14);
                }
        }
 }