public function getGoogleFontURLs()
{
$urls = array();
// Gather all the fonts that we need to load, some may be repeated so we need to
// load them once after gathering them
$fontsToLoad = array();
foreach (self::$optionsToEnqueue as $option) {
$fontValue = $option->getValue();
if (empty($fontValue['font-family'])) {
continue;
}
if ($fontValue['font-family'] == 'inherit') {
continue;
}
if ($fontValue['font-type'] != 'google') {
continue;
}
// Stop load Custom Fonts
if (in_array($fontValue['font-family'], $this->settings['fonts'])) {
continue;
}
// Get all the fonts that we need to load
if (empty($fontsToLoad[$fontValue['font-family']])) {
$fontsToLoad[$fontValue['font-family']] = array();
}
// Get the weight
$variant = $fontValue['font-weight'];
if ($variant == 'normal') {
$variant = '400';
} else {
if ($variant == 'bold') {
$variant = '500';
} else {
if ($variant == 'bolder') {
$variant = '800';
} else {
if ($variant == 'lighter') {
$variant = '100';
}
}
}
}
if ($fontValue['font-style'] == 'italic') {
$variant .= 'italic';
}
$fontsToLoad[$fontValue['font-family']][] = $variant;
}
// Font subsets, allow others to change this
$subsets = apply_filters('tf_google_font_subsets_' . $this->getOptionNamespace(), array('latin', 'latin-ext'));
// Enqueue the Google Font
foreach ($fontsToLoad as $fontName => $variants) {
// Always include the normal weight so that we don't error out
$variants[] = '400';
$variants = array_unique($variants);
$fontUrl = sprintf('//fonts.googleapis.com/css?family=%s:%s&subset=%s', str_replace(' ', '+', $fontName), implode(',', $variants), implode(',', $subsets));
$fontUrl = apply_filters('tf_enqueue_google_webfont_' . $this->getOptionNamespace(), $fontUrl, $fontName);
if ($fontUrl != false) {
$urls[$fontName] = $fontUrl;
}
}
return $urls;
}