/**
  * Constructor.
  */
 public function __construct()
 {
     // This MUST come before we get details about the plugins so the headers are correctly retrieved
     GitHub_Updater_GitHub_API::add_headers();
     // Get details of GitHub-sourced plugins
     $this->config = $this->get_plugin_meta();
     if (empty($this->config)) {
         return false;
     }
     if (isset($_GET['force-check']) && '1' === $_GET['force-check']) {
         $this->delete_all_transients('plugins');
     }
     foreach ((array) $this->config as $plugin) {
         switch ($plugin->type) {
             case 'github_plugin':
                 $repo_api = new GitHub_Updater_GitHub_API($plugin);
                 break;
             case 'bitbucket_plugin':
                 $repo_api = new GitHub_Updater_BitBucket_API($plugin);
                 break;
         }
         $this->{$plugin->type} = $plugin;
         $this->set_defaults($plugin->type);
         if ($repo_api->get_remote_info(basename($plugin->slug))) {
             $repo_api->get_repo_meta();
             $repo_api->get_remote_tag();
             $changelog = $this->get_changelog_filename($plugin->type);
             if ($changelog) {
                 $repo_api->get_remote_changes($changelog);
             }
             $plugin->download_link = $repo_api->construct_download_link();
         }
     }
     $this->make_force_check_transient('plugins');
     add_filter('pre_set_site_transient_update_plugins', array($this, 'pre_set_site_transient_update_plugins'));
     add_filter('plugins_api', array($this, 'plugins_api'), 99, 3);
     add_filter('upgrader_source_selection', array($this, 'upgrader_source_selection'), 10, 3);
     add_filter('http_request_args', array($this, 'no_ssl_http_request_args'), 10, 2);
     GitHub_Updater_Settings::$ghu_plugins = $this->config;
 }