function fontyourface_preprocess_page in @font-your-face 6.2
Same name and namespace in other branches
- 6 fontyourface.module \fontyourface_preprocess_page()
- 7 fontyourface.module \fontyourface_preprocess_page()
Implements template_preprocess_page().
File
- ./
fontyourface.module, line 494
Code
function fontyourface_preprocess_page(&$vars) {
$fonts = fontyourface_font_registry();
$css = '';
$destination = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . file_directory_path() . '/fontyourface/font.css';
$destination_directory = dirname($destination);
if (file_check_directory($destination_directory, FILE_CREATE_DIRECTORY)) {
if (strpos($_GET['q'], 'admin/build/themes/fontyourface/edit/') === 0) {
$adding_font = fontyourface_get_font(arg(5));
if ($adding_font) {
$fonts[] = $adding_font;
}
// if
}
// elseif
$enabled_fonts = fontyourface_get_fonts();
foreach ($enabled_fonts as $font) {
$font_css = fontyourface_font_css($font);
if ($font_css != '' && $font->css_selector != '') {
$css .= $font->css_selector . ' { ' . $font_css . ' }' . "\n";
}
// if
$fonts[] = $font;
}
// foreach
file_save_data($css, $destination, FILE_EXISTS_REPLACE);
}
// if
if ($css != '') {
fontyourface_add_css_in_preprocess($vars, file_directory_path() . '/fontyourface/font.css');
}
// if
$vars['fontyourface'] = $fonts;
}