diff options
author | Andrew Dolgov <[email protected]> | 2013-04-19 17:26:22 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-04-19 17:26:22 +0400 |
commit | ddf28801e4720b9d7888b9bca5daf6be14d3720c (patch) | |
tree | 64c7b416dc73065f9efb6c61939757158d6dd3e4 /classes/pluginhost.php | |
parent | 726bd48e8c0e42d97270367c0c49a7ef0e6609b5 (diff) |
implement plugin API version compatibility check
Diffstat (limited to 'classes/pluginhost.php')
-rw-r--r-- | classes/pluginhost.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php index d51f70214..dc75e31fb 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -13,6 +13,8 @@ class PluginHost { private $last_registered; private static $instance; + const API_VERSION = 1; + const HOOK_ARTICLE_BUTTON = 1; const HOOK_ARTICLE_FILTER = 2; const HOOK_PREFS_TAB = 3; @@ -137,6 +139,13 @@ class PluginHost { if (class_exists($class) && is_subclass_of($class, "Plugin")) { $plugin = new $class($this); + $plugin_api = $plugin->api_version(); + + if ($plugin_api < PluginHost::API_VERSION) { + user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING); + continue; + } + $this->last_registered = $class; switch ($kind) { |