summaryrefslogtreecommitdiff
path: root/program/include/rcube_plugin.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2009-05-21 20:34:28 +0000
committerthomascube <thomas@roundcube.net>2009-05-21 20:34:28 +0000
commitc73b195e5d02a09d56430dd6e666313b86fee2f9 (patch)
treedec1d935a0a9dda33b2a4771a3a03c325d02d64a /program/include/rcube_plugin.php
parent66f68e96236848e8f1dd5992f1d7d0c5cc6da2a9 (diff)
Add function for plugins to load a local config file
Diffstat (limited to 'program/include/rcube_plugin.php')
-rw-r--r--program/include/rcube_plugin.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php
index 365ef2898..63acaf84e 100644
--- a/program/include/rcube_plugin.php
+++ b/program/include/rcube_plugin.php
@@ -47,6 +47,20 @@ abstract class rcube_plugin
* Initialization method, needs to be implemented by the plugin itself
*/
abstract function init();
+
+ /**
+ * Load local config file from plugins directory.
+ * The loaded values are patched over the global configuration.
+ *
+ * @param string Config file name relative to the plugin's folder
+ */
+ public function load_config($fname = 'config.inc.php')
+ {
+ $fpath = $this->home.'/'.$fname;
+ $rcmail = rcmail::get_instance();
+ if (!$rcmail->config->load_from_file($fpath))
+ raise_error(array('code' => 527, 'type' => 'php', 'message' => "Failed to load config from $fpath"), true, false);
+ }
/**
* Register a callback function for a specific (server-side) hook