isEnabled() public method

Check whether or not an addon is enabled.
public isEnabled ( string $key, string $type ) : boolean
$key string The addon key.
$type string One of the **Addon::TYPE_*** constants.
return boolean Returns
Example #1
0
 /**
  * Disable a plugin.
  *
  * @param string $pluginName The name of the plugin.
  * @return bool
  * @throws Exception
  */
 public function disablePlugin($pluginName)
 {
     $addon = $this->addonManager->lookupAddon($pluginName);
     if (!$addon) {
         return false;
     }
     $pluginClassName = $addon->getPluginClass();
     $pluginName = $addon->getRawKey();
     $enabled = $this->addonManager->isEnabled($pluginName, Addon::TYPE_ADDON);
     try {
         $this->addonManager->checkDependants($addon, true);
     } catch (\Exception $ex) {
         throw new Gdn_UserException($ex->getMessage(), 400);
     }
     // 2. Perform necessary hook action
     $this->pluginHook($pluginName, self::ACTION_DISABLE, true);
     // 3. Disable it.
     saveToConfig("EnabledPlugins.{$pluginName}", false);
     $this->addonManager->stopAddon($addon);
     // 4. Unregister the plugin properly.
     $this->unregisterPlugin($pluginClassName);
     if ($enabled) {
         Logger::event('addon_disabled', Logger::INFO, 'The {addonName} plugin was disabled.', array('addonName' => $pluginName));
     }
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
     Gdn::locale()->refresh();
     $this->EventArguments['AddonName'] = $pluginName;
     $this->fireEvent('AddonDisabled');
     return true;
 }
 /**
  * Check whether or not an application is enabled.
  *
  * @param string $Name The name of the application.
  * @return bool Whether or not the application is enabled.
  * @since 2.2
  * @deprecated
  */
 public function isEnabled($Name)
 {
     deprecated('Gdn_ApplicationManager->isEnabled()', 'AddonManager->isEnabled()');
     return $this->addonManager->isEnabled($Name, Addon::TYPE_ADDON);
 }