You are here

function fontsquirrel_update_font_family in @font-your-face 6

Gets font family details from API.

1 call to fontsquirrel_update_font_family()
fontsquirrel_fontyourface_css in modules/fontsquirrel/fontsquirrel.module
Implements hook_fontyourface_css().

File

modules/fontsquirrel/fontsquirrel.module, line 206

Code

function fontsquirrel_update_font_family(&$font) {
  $api_result = drupal_http_request('http://www.fontsquirrel.com/api/familyinfo/' . $font['path']);
  if ($api_result->code == '200') {
    $decoded = json_decode($api_result->data);
    if (is_array($decoded) && is_object($decoded[0])) {
      $font['family'] = $decoded[0]->{'fontface_name'};
      db_query("UPDATE {fontsquirrel_group} g SET font_family = '%s' WHERE gid = %d", $font['family'], $font['id']);
    }

    // if
  }

  // if
}