} else { echo 'Droid Sans'; } ?> ", "<?php if ($h1font = of_get_option('of_p_font')) { echo function_exists('ag_is_default') ? ag_is_default($h1font['face']) . $cyrillic_suffix : $h1font['face'] . $cyrillic_suffix; } else { echo 'Open Sans'; } ?> ", "<?php if ($h2font = of_get_option('of_tiny_font')) { echo function_exists('ag_is_default') ? ag_is_default($h2font['face']) . $cyrillic_suffix : $h2font['face'] . $cyrillic_suffix; } else { echo 'Open Sans'; } ?> "] } }; (function() { var wf = document.createElement('script'); wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wf, s); })();
function ag_load_fonts() { $cyrillic = of_get_option('of_cyrillic_chars'); // Initialize Variables $fonts = ''; $font_faces = array(); $cyrillic_chars = ''; // Get All Font Options $option_fonts = array(of_get_option('of_nav_font'), of_get_option('of_heading_font'), of_get_option('of_page_subtitle_font'), of_get_option('of_secondary_font'), of_get_option('of_content_heading_font'), of_get_option('of_button_font'), of_get_option('of_tiny_font'), of_get_option('of_p_font')); foreach ($option_fonts as $option) { // Make sure the font face isn't a non-google font. if (!ag_is_default($option['face'])) { // Store all font typefaces in an array array_push($font_faces, $option['face']); } } // Remove duplicate values $font_faces = array_unique($font_faces); // Check for cyrillic character option if ($cyrillic == 'Yes') { $cyrillic_chars = '::cyrillic,latin'; } $fonts .= "\n\t <!-- Embed Google Web Fonts Via API -->\n\t <script type='text/javascript'>\n\t WebFontConfig = {\n\t google: { families: [ "; // Store the font list. $fontlist = ''; foreach ($font_faces as $font) { $fontlist .= $font ? "'" . $font . $cyrillic_chars . "', " : "'" . 'Source Sans Pro' . $cyrillic_chars . "', "; } // Trim the last comma and space for IE and store in fonts $fonts .= rtrim($fontlist, ', '); $fonts .= " ] } };\n\t (function() {\n\t var wf = document.createElement('script');\n\t wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +\n\t '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';\n\t wf.type = 'text/javascript';\n\t wf.async = 'true';\n\t var s = document.getElementsByTagName('script')[0];\n\t s.parentNode.insertBefore(wf, s);\n\t })();\n\t </script>"; return $fonts; }