You are here

public function JanrainCaptureApi::getShareProviders in Janrain Registration 7.4

Same name and namespace in other branches
  1. 7.2 includes/janrain_capture.api.inc \JanrainCaptureApi::getShareProviders()

Retrieves a list of Social Sharing providers for Engage

File

includes/janrain_capture.api.inc, line 233
An API Client for making calls to the Janrain Capture web service.

Class

JanrainCaptureApi
@file An API Client for making calls to the Janrain Capture web service.

Code

public function getShareProviders() {
  $items = $this
    ->call('settings/items');
  $rpx_key = $items['result']['rpx_key'];
  $headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded',
    'User-Agent' => 'Drupal/janrain_capture-' . JANRAIN_CAPTURE_MODULE_VERSION,
  );
  $url = sprintf('https://rpxnow.com/plugin/lookup_rp?apiKey=%s', $rpx_key);
  $options = array(
    'headers' => $headers,
  );
  $result = drupal_http_request($url, $options);
  $json_data = $this
    ->decodeData($result);
  if (isset($json_data['shareProviders'])) {
    return explode(',', $json_data['shareProviders']);
  }
  else {
    return FALSE;
  }
}