You are here

function _brightcove_configure_client in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.module \_brightcove_configure_client()
1 call to _brightcove_configure_client()
brightcove_init in ./brightcove.module
Implements hook_init().

File

./brightcove.module, line 82
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function _brightcove_configure_client() {
  static $confmap = [
    'http_proxy_tunnel' => 'httpProxyTunnel',
    'proxy_auth' => 'proxyAuth',
    'proxy_port' => 'proxyPort',
    'proxy_type' => 'proxyType',
    'proxy' => 'proxy',
    'proxy_user_password' => 'proxyUserPassword',
    'retry_ratelimited' => 'retry',
  ];
  brightcove_load_lib(TRUE);
  if (!class_exists('\\Brightcove\\API\\Client')) {
    $msg = t('Brightcove client is not found');
    if (function_exists('drush_log')) {
      drush_log($msg, 'warning');
    }
    else {
      drupal_set_message($msg, 'error');
    }
    return;
  }
  foreach ($confmap as $name => $property) {
    $val = variable_get("brightcove_{$name}");
    if ($val) {
      \Brightcove\API\Client::${$property} = $val;
    }
  }
  \Brightcove\API\Client::$consumer = 'Drupal/' . VERSION . ' Brightcove/' . (system_get_info('module', 'brightcove')['version'] ?: 'dev');
}