Example #1
0
 /**
  * Returns all available plugin settings, even settings for inactive plugins. A plugin has to specify a file named
  * `Settings.php` containing a class named `Settings` that extends `Piwik\Plugin\Settings` in order to be
  * considered as a plugin setting. Otherwise the settings for a plugin won't be available.
  *
  * @return \Piwik\Plugin\Settings[]   An array containing array([pluginName] => [setting instance]).
  */
 public static function getAllPluginSettings()
 {
     $numActivatedPlugins = PluginManager::getInstance()->getNumberOfActivatedPlugins();
     if (static::$numPluginsChecked != $numActivatedPlugins) {
         static::$numPluginsChecked = $numActivatedPlugins;
         static::$settings = array();
     }
     if (empty(static::$settings)) {
         $settings = array();
         $pluginNames = PluginManager::getInstance()->getLoadedPluginsName();
         foreach ($pluginNames as $pluginName) {
             $settings[$pluginName] = self::getPluginSettingsClass($pluginName);
         }
         static::$settings = array_filter($settings);
     }
     return static::$settings;
 }
Example #2
0
 /**
  * Returns all available plugin settings, even settings for inactive plugins. A plugin has to specify a file named
  * `Settings.php` containing a class named `Settings` that extends `Piwik\Plugin\Settings` in order to be
  * considered as a plugin setting. Otherwise the settings for a plugin won't be available.
  *
  * @return \Piwik\Plugin\Settings[]   An array containing array([pluginName] => [setting instance]).
  */
 public static function getAllPluginSettings()
 {
     $numActivatedPlugins = PluginManager::getInstance()->getNumberOfActivatedPlugins();
     if (static::$numPluginsChecked != $numActivatedPlugins) {
         static::$numPluginsChecked = $numActivatedPlugins;
         static::$settings = array();
     }
     if (empty(static::$settings)) {
         $settings = PluginManager::getInstance()->findComponents('Settings', 'Piwik\\Plugin\\Settings');
         $byPluginName = array();
         foreach ($settings as $setting) {
             $byPluginName[$setting->getPluginName()] = $setting;
         }
         static::$settings = $byPluginName;
     }
     return static::$settings;
 }