function fonts_com_get_all_fonts in @font-your-face 7.2
Gets a list of all fonts, in given range.
2 calls to fonts_com_get_all_fonts()
- fonts_com_browse_form in modules/
fonts_com/ fonts_com.module - Shows browse filters and results.
- fonts_com_import_process in modules/
fonts_com/ fonts_com.module - Processes importing fonts.
File
- modules/
fonts_com/ api.inc, line 48 - API functions.
Code
function fonts_com_get_all_fonts($start = 0, $limit = 100, $filters = array()) {
$result = array(
'fonts' => array(),
'count' => FALSE,
);
if (isset($filters['wfsfree']) && $filters['wfsfree'] == 0) {
$filters['wfsfree'] = 'true';
}
// if
if (isset($filters['wfsfree']) && $filters['wfsfree'] == -1) {
$filters['wfsfree'] = 'false';
}
// if
$query = array(
'wfspstart' => $start,
'wfsplimit' => $limit,
) + $filters;
$path = '/rest/json/AllFonts/?' . drupal_http_build_query($query);
$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);
$font = $data->AllFonts->Font;
$result['fonts'] = fonts_com_unknown_to_array($font);
$result['count'] = intval($data->AllFonts->TotalRecords);
}
else {
drupal_set_message(t('There was an error importing a font list 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),
));
}
// else
return $result;
}