diff options
author | Andrew Dolgov <[email protected]> | 2012-12-23 23:05:51 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-12-23 23:05:51 +0400 |
commit | 8dcb2b47628346226b18940b5cde7849f7a24687 (patch) | |
tree | ca3ee70e34095455614f4c2c7f9d69ce9f1ed27c /backend.php | |
parent | 5cedb389d24861a94c1183d1562900dbe59ee3fb (diff) |
implement plugin routing masks, add example plugin
Diffstat (limited to 'backend.php')
-rw-r--r-- | backend.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/backend.php b/backend.php index 8aaf10016..2cac8232b 100644 --- a/backend.php +++ b/backend.php @@ -118,10 +118,18 @@ $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)) { |