function fonts_com_fontyourface_import in @font-your-face 7
Same name and namespace in other branches
- 6.2 modules/fonts_com/fonts_com.module \fonts_com_fontyourface_import()
Implements hook_fontyourface_import().
File
- modules/
fonts_com/ fonts_com.module, line 23
Code
function fonts_com_fontyourface_import() {
$import_fonts = array();
$projects = fonts_com_get_projects();
foreach ($projects as $project) {
$fonts = array();
$domains = fonts_com_get_domains_in_project($project->ProjectKey);
$domain_match = FALSE;
foreach ($domains as $domain) {
if ($domain->DomainName == $_SERVER['HTTP_HOST']) {
$domain_match = TRUE;
}
// if
}
// foreach
if ($domain_match) {
$fonts = fonts_com_get_fonts_in_project($project->ProjectKey);
foreach ($fonts as $font) {
$font->project = $project;
$import_fonts[] = $font;
}
// foreach
}
// if
}
// foreach
foreach ($import_fonts as $import_font) {
$metadata = array(
'project_id' => $import_font->project->ProjectKey,
);
$font = new stdClass();
$font->name = $import_font->FontName;
$font->url = 'http://webfonts.fonts.com/en-US/Project/ChooseFonts?ViewDetails=T&ViewFontID=' . $import_font->FontID . '&AddFontToPalette=T';
$font->provider = 'fonts_com';
$font->metadata = serialize($metadata);
$font->css_family = '"' . $import_font->FontCSSName . '"';
$font->foundry = $import_font->FontFondryName;
$font->tags = array();
fontyourface_save_font($font);
}
// foreach
}