You are here

function fonts_com_api_headers in @font-your-face 7.2

Same name and namespace in other branches
  1. 6.2 modules/fonts_com/fonts_com.module \fonts_com_api_headers()
  2. 7 modules/fonts_com/fonts_com.module \fonts_com_api_headers()

Provides headers with api parameters.

17 calls to fonts_com_api_headers()
fonts_com_add_domain in modules/fonts_com/api.inc
Adds a single domain to a project.
fonts_com_add_font_to_project in modules/fonts_com/api.inc
Adds font to project.
fonts_com_add_selector_to_project in modules/fonts_com/api.inc
Adds selector to project.
fonts_com_delete_domain in modules/fonts_com/api.inc
Deletes a single domain in a project.
fonts_com_delete_font_from_project in modules/fonts_com/api.inc
Deletes font from project.

... See full list

File

modules/fonts_com/api.inc, line 772
API functions.

Code

function fonts_com_api_headers($path) {
  $fonts_com_token = variable_get('fonts_com_token', '');
  if (empty($fonts_com_token)) {
    return array();
  }

  // if
  list($public_key, $private_key) = explode('--', $fonts_com_token);
  $encoded = base64_encode(hash_hmac('md5', $public_key . '|' . $path, $private_key, TRUE));
  $auth = urlencode($public_key . ':' . $encoded);
  return array(
    'Authorization' => $auth,
    'AppKey' => FONTS_COM_API_APP_KEY,
  );
}