| | |
| | | class rcube_plugin_api |
| | | { |
| | | static private $instance; |
| | | |
| | | |
| | | public $dir; |
| | | public $url = 'plugins/'; |
| | | public $output; |
| | | public $config; |
| | | |
| | | public $allowed_prefs = array(); |
| | | public $allowed_session_prefs = array(); |
| | | |
| | | public $handlers = array(); |
| | | private $plugins = array(); |
| | | private $tasks = array(); |
| | |
| | | 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($rcmail->output, 'rcube_template')) |
| | | && (!$plugin->noajax || (is_object($rcmail->output) && is_a($rcmail->output, 'rcube_template'))) |
| | | && (!$plugin->noframe || empty($_REQUEST['_framed'])) |
| | | ) { |
| | | $plugin->init(); |
| | | $this->plugins[$plugin_name] = $plugin; |
| | | } |
| | | if (!empty($plugin->allowed_prefs)) { |
| | | $this->allowed_prefs = array_merge($this->allowed_prefs, $plugin->allowed_prefs); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns list of loaded plugins names |
| | | * |
| | | * @return array List of plugin names |
| | | */ |
| | | public function loaded_plugins() |
| | | { |
| | | return array_keys($this->plugins); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Callback for template_container hooks |
| | | * |
| | | * @param array $attrib |