function fonts_com_import_process in @font-your-face 7.2
Processes importing fonts.
File
- modules/
fonts_com/ fonts_com.module, line 110
Code
function fonts_com_import_process(&$context) {
module_load_include('inc', 'fonts_com', 'api');
$per_page = 200;
if (empty($context['sandbox'])) {
$context['sandbox'] = array();
$context['sandbox']['progress'] = 1;
$context['sandbox']['max'] = fonts_com_get_all_fonts_count();
}
// if
$import_results = fonts_com_get_all_fonts($context['sandbox']['progress'], $per_page);
$import_fonts = $import_results['fonts'];
foreach ($import_fonts as $import_font) {
$font = fonts_com_api_to_font($import_font);
fontyourface_save_font($font);
}
// foreach
$context['sandbox']['progress'] += $per_page;
if ($context['sandbox']['progress'] < $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
else {
$context['finished'] = 1;
}
// else
}