gh 新增 google adsense 判断

master
Layne 1 year ago
parent 45a9c583fa
commit 8bfafd1eef

@ -900,16 +900,17 @@ class Information extends CI_Controller
}
}
$data_H1['ic_title'] = $information->ic_title;
// 检查图片地址格式
$parsed_photo = $information->ic_photo;
$parsed_photo_url = parse_url($information->ic_photo);
if ((!isset($parsed_photo_url['host']) || !isset($parsed_photo_url['scheme'])) && isset($parsed_photo_url['path'])) {
if (
(!isset($parsed_photo_url['host']) || !isset($parsed_photo_url['scheme'])) && isset($parsed_photo_url['path'])
) {
$parsed_photo = 'https://images.chinahighlights.com' . $parsed_photo_url['path'];
}
$data_H1['ic_title'] = $information->ic_title;
$data_H1['ic_photo'] = $parsed_photo;
// $data_H1['ic_photo'] = $information->ic_photo;
$data_H1['breadcrumb_data'] = $breadcrumb_data;
$data_H1['ads_by_google'] = $ads_by_google;
$data_H1['ic_datetime'] = $information->ic_datetime;
@ -1844,6 +1845,22 @@ class Information extends CI_Controller
$html_path .= $html_path_ext;
create_folder_by_path(dirname($html_path));
file_put_contents($html_path, $template, LOCK_EX);
// 未勾选In Article 广告时,加入标签 <meta name="ezoic" content="noads"/>,让 ezoic 识别出该页面不展示广告。
$meta_google_ad_article = get_meta($information->ic_id, 'meta_google_ad_article');
if (empty($meta_google_ad_article) || !$meta_google_ad_article) {
$template = str_replace(
'<!--@Meta-Ezoic-NoAds@-->',
'<meta name="ezoic" content="noads"/>',
$template
);
} else {
$template = str_replace(
'<!--@Meta-Ezoic-NoAds@-->',
'',
$template
);
}
}
public function make_www_cache_ah($device, $information, $recommand_information)

@ -12,6 +12,7 @@
<meta name="apple-mobile-web-app-title" content="Global Highlights - Since 2018!">
<meta name="keywords" content="<!--@KEYWORDS@-->">
<meta name="description" content="<!--@DESCRIPTION@-->">
<!--@Meta-Ezoic-NoAds@-->
<!--@OG:IMAGE@-->
<link rel="canonical" href="<!--@CANONICAL@-->">
<link rel="shortcut icon" href="/favicon.ico">

Loading…
Cancel
Save