Author Topic: Check Plugin  (Read 6558 times)

Offline horfic

  • Jr. Member
  • **
  • Posts: 49
Check Plugin
« on: September 09, 2009, 11:23:37 AM »
How can i check if a plugin is activated in the main config?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
Check Plugin
« Reply #1 on: September 09, 2009, 01:59:54 PM »
look for $rcmail_config['plugins'], if the plugin is in the array then it is activated.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline horfic

  • Jr. Member
  • **
  • Posts: 49
Check Plugin
« Reply #2 on: September 09, 2009, 04:01:18 PM »
$rcmail_config['plugin'] didn't work so i accessed the config with rcmail::get_instance()->config->get('plugins'), but when i want to check if it is in the array like with the function in_array or array_key_exists it just blanks whole roundcube site.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Check Plugin
« Reply #3 on: September 09, 2009, 11:53:49 PM »

$rcmail
->rcmail::get_instance();
$plugins $rcmail->config->get('plugins');
$plugins array_flip($plugins);
if(isset(
$plugins['myplugin'])){
  
//registered
}
else{
  
//not registered
}
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline horfic

  • Jr. Member
  • **
  • Posts: 49
Check Plugin
« Reply #4 on: September 10, 2009, 05:06:55 AM »
Thanks rosali!:)