pluginhost: add get_debug()/set_debug() for plugins to detect if debugging is allowed

This commit is contained in:
Andrew Dolgov 2013-02-26 19:30:19 +04:00
parent 70caff4811
commit be17885789
2 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ class PluginHost {
private $commands = array(); private $commands = array();
private $storage = array(); private $storage = array();
private $owner_uid; private $owner_uid;
private $debug;
const HOOK_ARTICLE_BUTTON = 1; const HOOK_ARTICLE_BUTTON = 1;
const HOOK_ARTICLE_FILTER = 2; const HOOK_ARTICLE_FILTER = 2;
@ -290,5 +291,13 @@ class PluginHost {
$_SESSION["plugin_storage"] = $this->storage; $_SESSION["plugin_storage"] = $this->storage;
} }
} }
function set_debug($debug) {
$this->debug = $debug;
}
function get_debug() {
return $this->debug;
}
} }
?> ?>

View File

@ -274,6 +274,7 @@
} }
$pluginhost = new PluginHost($link); $pluginhost = new PluginHost($link);
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref($link, "_ENABLED_PLUGINS", $owner_uid); $user_plugins = get_pref($link, "_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, $pluginhost::KIND_ALL); $pluginhost->load(PLUGINS, $pluginhost::KIND_ALL);