[RCD] Load plugin config from plugin folder

Roland Liebl roland at roland-liebl.de
Mon May 18 09:42:00 CEST 2009


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" <robk at mun.ca>
To: "RoundCube Dev" <dev at lists.roundcube.net>
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 <robk at mun.ca> 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;
> ...
> }
>
> -- 
> Robert King
> System Administrator
> Computing & Communications
> Memorial University
> _______________________________________________
> List info: http://lists.roundcube.net/dev/
> 


_______________________________________________
List info: http://lists.roundcube.net/dev/



More information about the Dev mailing list