diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-05-21 20:34:28 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-05-21 20:34:28 +0000 |
| commit | 9b0aa170e0313acb11ed02d06aea49ab3248e9b6 (patch) | |
| tree | 06851d0f1ada8eded5db0ad5052b0574dc465e45 /roundcubemail/program/include/rcube_plugin.php | |
| parent | 2c1da0d681334a1322d6cbf21ce36079131a3041 (diff) | |
Add function for plugins to load a local config file
git-svn-id: https://svn.roundcube.net/trunk@2516 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_plugin.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_plugin.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/roundcubemail/program/include/rcube_plugin.php b/roundcubemail/program/include/rcube_plugin.php index 365ef2898..63acaf84e 100644 --- a/roundcubemail/program/include/rcube_plugin.php +++ b/roundcubemail/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 |
