You are here

function lockr_partner in Lockr 7.2

Returns the current partner for this site.

1 call to lockr_partner()
lockr_client in ./lockr.module
Returns the Lockr client for this site.

File

./lockr.module, line 136
Hook implementations and callbacks for lockr.

Code

function lockr_partner() {
  $partner =& drupal_static(__FUNCTION__, NULL);
  if ($partner !== NULL) {
    return $partner;
  }
  $region = variable_get('lockr_region', 'us');
  if (variable_get('lockr_custom', FALSE)) {
    $cert_path = variable_get('lockr_cert');
    if ($cert_path && is_readable($cert_path)) {
      $partner = new Partner($cert_path, 'custom', $region);
      return $partner;
    }
    $partner = new NullPartner($region);
    return $partner;
  }
  $detected_partner = lockr_get_partner();
  if (!$detected_partner) {
    $partner = new NullPartner($region);
    return $partner;
  }
  $partner = new Partner($detected_partner['cert'], $detected_partner['name'], $region);
  return $partner;
}