From 8bfafd1eef7153e8dace3edd08ca69a21d9f8935 Mon Sep 17 00:00:00 2001 From: Layne <2320908474@qq.com> Date: Fri, 8 Mar 2024 14:35:26 +0800 Subject: [PATCH] =?UTF-8?q?gh=20=E6=96=B0=E5=A2=9E=20google=20adsense=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 25 ++++++++++++++++++++---- application/views/mobile_first/gh-pc.php | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 0eb57b84..68164e02 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -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 广告时,加入标签 ,让 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( + '', + '', + $template + ); + } else { + $template = str_replace( + '', + '', + $template + ); + } } public function make_www_cache_ah($device, $information, $recommand_information) diff --git a/application/views/mobile_first/gh-pc.php b/application/views/mobile_first/gh-pc.php index c804babd..c8f6b984 100644 --- a/application/views/mobile_first/gh-pc.php +++ b/application/views/mobile_first/gh-pc.php @@ -12,6 +12,7 @@ +