【发布时间】:2014-05-05 17:07:32
【问题描述】:
我收到一个错误,该网站无缘无故在 chrome 中被阻止。
因为它是一个小型网站,所以我将所有页面都强制使用 SSL。并收到此错误:
[阻止] 'https://www.splitapartments.co/' 处的页面通过 HTTPS 加载,但运行来自 'http://fonts.googleapis.com/css?family=Open+Sans:400,800,300,700' 的不安全内容:此内容也应通过 HTTPS 加载。
WordPress 主题排队 google 字体安全模式:
function dt_get_google_fonts( $font = '', $effect = '' ) {
if ( ! $font ) {
return;
}
if ( array_key_exists( $effect, dt_get_web_fonts_effects() ) ) {
$effect = '&effect=' . esc_attr( $effect );
} else {
$effect = '';
}
$protocol = "http";
if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) {
$protocol = "https";
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo $protocol; ?>://fonts.googleapis.com/css?family=<?php echo str_replace( ' ', '+', $font ) . $effect; ?>">
<?php
}
function dt_make_web_font_uri( $font, $effect = '' ) {
if ( !$font ) {
return false;
}
// add web font effect
if ( function_exists('dt_get_web_fonts_effects') ) {
if ( array_key_exists( $effect, dt_get_web_fonts_effects() ) ) {
$effect = '&effect=' . esc_attr( $effect );
} else {
$effect = '';
}
} else {
$effect = '';
}
$protocol = is_ssl() ? "https" : "http";
$uri = $protocol . '://fonts.googleapis.com/css?family=' . str_replace( ' ', '+', $font ) . $effect;
return $uri;
}
我完全不明白为什么会这样。我尝试了所有我能找到的解决方案,但没有任何效果。
【问题讨论】:
标签: wordpress ssl google-webfonts