function fonts_com_get_projects in @font-your-face 6.2
Same name and namespace in other branches
- 7.2 modules/fonts_com/api.inc \fonts_com_get_projects()
- 7 modules/fonts_com/fonts_com.module \fonts_com_get_projects()
Gets list of projects from API.
1 call to fonts_com_get_projects()
- fonts_com_fontyourface_import in modules/
fonts_com/ fonts_com.module - Implements hook_fontyourface_import().
File
- modules/
fonts_com/ fonts_com.module, line 236
Code
function fonts_com_get_projects() {
$logging = variable_get('fontyourface_detailed_logging', FALSE);
$projects = array();
$path = '/rest/json/Projects/?wfspstart=0&wfsplimit=100';
$response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, fonts_com_api_headers($path));
if ($response->code == 200) {
$data = json_decode($response->data);
$project = $data->Projects->Project;
if (is_array($project)) {
$projects = $project;
}
else {
$projects[] = $project;
}
// else
}
else {
drupal_set_message(t('There was an error importing project list from Fonts.com.'), 'error');
if ($logging) {
watchdog('@font-your-face', 'Invalid drupal_http_request response: @response', array(
'@response' => print_r($response, TRUE),
), WATCHDOG_INFO);
}
// if
}
// else
return $projects;
}