Beispiel #1
0
/**
 * Import Google fonts.
 *
 * @since 1.0
 * @return an import URL of Google fonts, if any are currently selected.
 */
function dynamik_import_google_fonts()
{
    $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
    $dynamik_google_font_array = dynamik_google_font_array();
    $google_fonts = '';
    if (is_array(dynamik_get_design('font_type'))) {
        foreach ($dynamik_google_font_array as $google_font => $google_font_data) {
            if (in_array($google_font_data['value'], dynamik_get_design('font_type'))) {
                $google_fonts .= $google_font_data['url_string'];
            }
        }
    }
    $google_fonts_import = '';
    if (!empty($google_fonts)) {
        $google_fonts_import .= '

/* Import Google Fonts
------------------------------------------------------------ */
		';
        $google_fonts_import .= '
@import url(' . $protocol . '://fonts.googleapis.com/css?family=' . $google_fonts . ');
		';
    }
    return $google_fonts_import;
}
/**
 * Create a call to specified Google fonts for Child Theme Export.
 *
 * @since 1.0
 * @return a call to specified Google fonts.
 */
function dynamik_google_font_call()
{
    $dynamik_font_type = dynamik_get_design('font_type');
    if ($dynamik_font_type) {
        foreach ($dynamik_font_type as $key => $value) {
            $dynamik_font_type[$key] = $value;
        }
    }
    $dynamik_google_font_array = dynamik_google_font_array();
    $google_fonts = '';
    foreach ($dynamik_google_font_array as $google_font => $google_font_data) {
        if (in_array($google_font_data['value'], $dynamik_font_type)) {
            $google_fonts .= $google_font_data['url_string'];
        }
    }
    if (!empty($google_fonts)) {
        $google_font_call = 'http://fonts.googleapis.com/css?family=' . $google_fonts;
        return $google_font_call;
    } else {
        return false;
    }
}