Merge pull request #212 from JohnDoh/patch-1
add include_plugin function for optional plugins
| | |
| | | } |
| | | |
| | | /** |
| | | * Attempt to load the given plugin which is optional for the current plugin |
| | | * |
| | | * @param string Plugin name |
| | | * @return boolean True on success, false on failure |
| | | */ |
| | | public function include_plugin($plugin_name) |
| | | { |
| | | return $this->api->load_plugin($plugin_name, true, false); |
| | | } |
| | | |
| | | /** |
| | | * Load local config file from plugins directory. |
| | | * The loaded values are patched over the global configuration. |
| | | * |
| | |
| | | * |
| | | * @param string Plugin name |
| | | * @param boolean Force loading of the plugin even if it doesn't match the filter |
| | | * @param boolean Require loading of the plugin, error if it doesn't exist |
| | | * |
| | | * @return boolean True on success, false if not loaded or failure |
| | | */ |
| | | public function load_plugin($plugin_name, $force = false) |
| | | public function load_plugin($plugin_name, $force = false, $require = true) |
| | | { |
| | | static $plugins_dir; |
| | | |
| | |
| | | true, false); |
| | | } |
| | | } |
| | | else { |
| | | elseif ($require) { |
| | | rcube::raise_error(array('code' => 520, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Failed to load plugin file $fn"), true, false); |