From 6201aaf1cde2a0cb83a9f6b20899cd769b43a762 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Thu, 03 Apr 2014 07:08:14 -0400 Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail --- program/lib/Roundcube/rcube_plugin_api.php | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php index 33f04ea..feeeb19 100644 --- a/program/lib/Roundcube/rcube_plugin_api.php +++ b/program/lib/Roundcube/rcube_plugin_api.php @@ -35,8 +35,9 @@ public $url = 'plugins/'; public $task = ''; public $output; - public $handlers = array(); - public $allowed_prefs = array(); + public $handlers = array(); + public $allowed_prefs = array(); + public $allowed_session_prefs = array(); protected $plugins = array(); protected $tasks = array(); @@ -167,10 +168,11 @@ * Load the specified plugin * * @param string Plugin name + * @param boolean Force loading of the plugin even if it doesn't match the filter * * @return boolean True on success, false if not loaded or failure */ - public function load_plugin($plugin_name) + public function load_plugin($plugin_name, $force = false) { static $plugins_dir; @@ -180,7 +182,7 @@ } // plugin already loaded - if ($this->plugins[$plugin_name] || class_exists($plugin_name, false)) { + if ($this->plugins[$plugin_name]) { return true; } @@ -188,7 +190,9 @@ . DIRECTORY_SEPARATOR . $plugin_name . '.php'; if (file_exists($fn)) { - include $fn; + if (!class_exists($plugin_name, false)) { + include $fn; + } // instantiate class if exists if (class_exists($plugin_name, false)) { @@ -196,7 +200,7 @@ // check inheritance... if (is_subclass_of($plugin, 'rcube_plugin')) { // ... task, request type and framed mode - if ((!$plugin->task || preg_match('/^('.$plugin->task.')$/i', $this->task)) + if (($force || !$plugin->task || preg_match('/^('.$plugin->task.')$/i', $this->task)) && (!$plugin->noajax || (is_object($this->output) && $this->output->type == 'html')) && (!$plugin->noframe || empty($_REQUEST['_framed'])) ) { @@ -282,6 +286,7 @@ $composer = INSTALL_PATH . "/plugins/$plugin_name/composer.json"; if (file_exists($composer) && ($json = @json_decode(file_get_contents($composer), true))) { list($info['vendor'], $info['name']) = explode('/', $json['name']); + $info['version'] = $json['version']; $info['license'] = $json['license']; if ($license_uri = $license_uris[$info['license']]) $info['license_uri'] = $license_uri; @@ -403,7 +408,7 @@ $args = $ret + $args; } - if ($args['abort']) { + if ($args['break']) { break; } } -- Gitblit v1.9.1