You are here

function fonts_com_get_all_fonts_count in @font-your-face 7.2

Gets total font count.

2 calls to fonts_com_get_all_fonts_count()
fonts_com_fontyourface_count in modules/fonts_com/fonts_com.module
Returns count of fonts available via API.
fonts_com_import_process in modules/fonts_com/fonts_com.module
Processes importing fonts.

File

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

Code

function fonts_com_get_all_fonts_count() {
  $path = '/rest/json/AllFonts/?wfspstart=0&wfsplimit=1';
  $response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, array(
    'headers' => fonts_com_api_headers($path),
  ));
  if ($response->code == 200) {
    $data = json_decode($response->data);
    return $data->AllFonts->TotalRecords;
  }

  // if
  drupal_set_message(t('There was an error importing the font count from Fonts.com. Check !configuration.', array(
    '!configuration' => l(t('configuration'), 'admin/config/user-interface/fontyourface/fonts_com'),
  )), 'error');
  fontyourface_log('Invalid drupal_http_request response: @response', array(
    '@response' => print_r($response, TRUE),
  ));
  return FALSE;
}