public static function registerPlugin($plugin, $name = null, $type = null)
 {
     $pluginName = empty($name) ? $plugin->pluginName : $name;
     $pluginType = empty($type) ? $plugin->options['build'] !== 'free' ? 'premium' : 'free' : $type;
     if (!isset(self::$_plugins[$pluginName])) {
         self::$_plugins[$pluginName] = array();
     }
     self::$_plugins[$pluginName][$pluginType] = $plugin;
     self::$_installedPlugins[] = array('name' => $pluginName, 'type' => $type, 'plugin' => $plugin);
     self::$_hasPremiumPlugins = self::$_hasPremiumPlugins || 'premium' === $pluginType;
 }