OK, I've committed some changes (r2516) that add a function load_config() 
to the rcube_plugin class. Now plugins can call $this->load_config() to 
load a config file named config.inc.php from the plugin's directory. If a 
plugin holds a local config file, it's recommended to call 
$this->load_config() in the init method.

I hope this fits your needs...

~Thomas


Roland Liebl wrote:
>
>   Resolved like inspired by Robert King. Thanks! Patch is not required
>   anymore.
>
>   I would just need your opinion about:
>
>   http://lists.roundcube.net/mail-archive/dev/2009-05/0000053.html
>
>   Regards,
>   Roland
>
>   _______________
>    function _load_config($plugin)
>    {
>      $rcmail = rcmail::get_instance();
>      $config = $rcmail->config->get('plugins_dir') . "/" . $plugin .
>   "/config/config.inc.php";
>      if(file_exists($config))
>        include $config;
>      else if(file_exists($config . ".dist"))
>        include $config . ".dist";
>      if(is_array($rcmail_config)){
>        $rcmail->config->merge($rcmail_config);
>      }
>    }
>
>> ----- Original Message -----
>> From: "Robert King"<[email protected]>
>> To: "RoundCube Dev"<[email protected]>
>> Sent: Sunday, May 17, 2009 5:42 PM
>> Subject: Re: [RCD] Load plugin config from plugin folder
>>
>>
>>> On Sun, 17 May 2009 13:03:37 -0230, Robert King<[email protected]>  wrote:
>>>> In my plugins I've been calling a function in the plugin init of:
>>>>
>>>> class plugin_name extends rcube_plugin
>>>> {
>>>>
>>>> public function init()
>>>> {
>>>> _load_config();
>>>> }
>>>>
>>>> private function _load_config()
>>>> {
>>>> include('config.inc.php');
>>>> $this->config = (array) $_config;
>>>> }
>>>>
>>>> }
>>> Forgot this important detail:
>>>
>>> class plugin_name extends rcube_plugin
>>> {
>>> private $config;
>>> ...
>>> }
>>>
_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to