Thomas Bruederli
2013-11-14 cf319546617486ecd925efbc16c54885f83ec8ab
Make require_plugin() force loading of the required plugin
2 files modified
7 ■■■■■ changed files
program/lib/Roundcube/rcube_plugin.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_plugin_api.php 5 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_plugin.php
@@ -109,7 +109,7 @@
     */
    public function require_plugin($plugin_name)
    {
        return $this->api->load_plugin($plugin_name);
        return $this->api->load_plugin($plugin_name, true);
    }
    /**
program/lib/Roundcube/rcube_plugin_api.php
@@ -168,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;
@@ -197,7 +198,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']))
                    ) {