/**
  * Get an OAuthClient instance for CultureFeed.
  * @param string $endpoint
  *   Endpoint for the client.
  */
 public static function getOAuthClient($endpoint, $token, $secret, $application_key = NULL, $shared_secret = NULL)
 {
     if (!$application_key) {
         $application_key = variable_get('culturefeed_api_application_key', '');
         $shared_secret = variable_get('culturefeed_api_shared_secret', '');
     }
     $oauth_client = new CultureFeed_DefaultOAuthClient($application_key, $shared_secret, $token, $secret);
     $oauth_client->setEndpoint($endpoint);
     $http_client_factory = static::getHttpClientFactory();
     if (!$http_client_factory) {
         $http_client = new CultureFeed_DefaultHttpClient();
         // Enable the logging.
         // We only do this when the default HTTP client is used, because
         // the HttpClient interface does not have a enableLogging() method
         // and a logger is actually something that should be injected through
         // dependency injection.
         if (module_exists('culturefeed_devel')) {
             $http_client->enableLogging();
         }
     } else {
         $http_client = $http_client_factory->createHttpClient();
     }
     $http_client->setTimeout(variable_get('culturefeed_http_client_timeout', 10));
     if ($http_client instanceof CultureFeed_ProxySupportingClient) {
         $uri = @parse_url($endpoint);
         $proxy_server = variable_get('proxy_server', '');
         if ($proxy_server && (!is_callable('_drupal_http_use_proxy') || _drupal_http_use_proxy($uri['host']))) {
             $http_client->setProxyServer($proxy_server);
             $http_client->setProxyPort(variable_get('proxy_port', 8080));
             $http_client->setProxyUsername(variable_get('proxy_username', ''));
             $http_client->setProxyPassword(variable_get('proxy_password', ''));
         }
     }
     $oauth_client->setHttpClient($http_client);
     return $oauth_client;
 }