]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
implement plugin routing masks, add example plugin
[tt-rss.git] / backend.php
index 8aaf1001657c573c9dd3dabec24405674ccd2bdf..2cac8232b7f7a1aa3b93d7884f35856787597c4b 100644 (file)
 
        $op = str_replace("-", "_", $op);
 
-       if (class_exists($op)) {
-               $handler = new $op($link, $_REQUEST);
+       global $pluginhost;
+       $override = $pluginhost->lookup_handler($op, $method);
 
-               if ($handler && is_subclass_of($handler, 'Handler')) {
+       if (class_exists($op) || $override) {
+
+               if ($override) {
+                       $handler = $override;
+               } else {
+                       $handler = new $op($link, $_REQUEST);
+               }
+
+               if ($handler && implements_interface($handler, 'IHandler')) {
                        if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) {
                                if ($handler->before($method)) {
                                        if ($method && method_exists($handler, $method)) {