summaryrefslogtreecommitdiff
path: root/program/include/rcube_plugin_api.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-10-29 08:42:28 +0000
committeralecpl <alec@alec.pl>2010-10-29 08:42:28 +0000
commit2cd443315dbd0b3d7fdec78f0042f22d20e57ede (patch)
tree0e81b5b095dae063eccf99c9bb49359963a00296 /program/include/rcube_plugin_api.php
parentf0638be52a0bdb313e608447763eb4481770c4b2 (diff)
- Plugin API: add possibility to disable plugin in AJAX mode, 'noajax' property
- Plugin API: add possibility to disable plugin in framed mode, 'noframe' property
Diffstat (limited to 'program/include/rcube_plugin_api.php')
-rw-r--r--program/include/rcube_plugin_api.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index da171ecf4..f0fe8c20e 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -122,10 +122,16 @@ class rcube_plugin_api
// instantiate class if exists
if (class_exists($plugin_name, false)) {
$plugin = new $plugin_name($this);
- // check inheritance and task specification
- if (is_subclass_of($plugin, 'rcube_plugin') && (!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))) {
- $plugin->init();
- $this->plugins[] = $plugin;
+ // check inheritance...
+ if (is_subclass_of($plugin, 'rcube_plugin')) {
+ // ... task, request type and framed mode
+ if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $rcmail->task))
+ && (!$plugin->noajax || is_a($this->output, 'rcube_template'))
+ && (!$plugin->noframe || empty($_REQUEST['_framed']))
+ ) {
+ $plugin->init();
+ $this->plugins[] = $plugin;
+ }
}
}
else {
@@ -256,7 +262,7 @@ class rcube_plugin_api
$action = $task.'.'.$action;
else if (strpos($action, 'plugin.') !== 0)
$action = 'plugin.'.$action;
-
+
// can register action only if it's not taken or registered by myself
if (!isset($this->actionmap[$action]) || $this->actionmap[$action] == $owner) {
$this->actions[$action] = $callback;