|
|
|
@ -416,7 +416,10 @@ class Information extends CI_Controller
|
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
|
$this->make_www_cache_ah('mobile', $information_new);
|
|
|
|
|
$this->make_www_cache_ah('pc', $information_new);
|
|
|
|
|
} else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)) {
|
|
|
|
|
} else if (strcasecmp($site_code, "gh") == 0 && !empty($auto_update_cache)) {
|
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
|
$this->make_www_cache_gh($information_new);
|
|
|
|
|
}else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)) {
|
|
|
|
|
//chinatravel读取模板生成PC和移动优先文件
|
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
|
$this->make_www_cache_ct('mobile', $information_new);
|
|
|
|
@ -746,8 +749,13 @@ class Information extends CI_Controller
|
|
|
|
|
$template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1447610161" data-matched-content-rows-num="2,2" data-matched-content-columns-num="1,3" data-matched-content-ui-type="image_stacked,image_stacked"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
|
|
|
|
|
//}
|
|
|
|
|
//社媒分享图片
|
|
|
|
|
$full_ic_photo='';
|
|
|
|
|
if (!empty($information->ic_photo)) {
|
|
|
|
|
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
|
|
|
|
|
}else{
|
|
|
|
|
$full_ic_photo = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
|
|
}
|
|
|
|
|
if(!empty($full_ic_photo)){
|
|
|
|
|
$template = str_replace('<!--@OG:IMAGE@-->', '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">', $template);
|
|
|
|
|
}
|
|
|
|
|
//设置图片尺寸
|
|
|
|
@ -763,6 +771,48 @@ class Information extends CI_Controller
|
|
|
|
|
file_put_contents($html_path, $template, LOCK_EX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function make_www_cache_gh($information){
|
|
|
|
|
return false;
|
|
|
|
|
$data = array();
|
|
|
|
|
$data['information'] = $information;
|
|
|
|
|
//获取移动优先的模板,如果有的话
|
|
|
|
|
$template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
|
|
$template_mobile = $this->load->view($template_path, '', TRUE);
|
|
|
|
|
$template_pc = $this->load->view($template_path . '-pc', '', TRUE);
|
|
|
|
|
|
|
|
|
|
//替换模板中的标签
|
|
|
|
|
$template_mobile = str_replace('<!--@TITLE@-->', $information->ic_seo_title, $template_mobile);
|
|
|
|
|
$template_pc = str_replace('<!--@TITLE@-->', $information->ic_seo_title, $template_pc);
|
|
|
|
|
$template_mobile = str_replace('<!--@DESCRIPTION@-->', $information->ic_seo_description, $template_mobile);
|
|
|
|
|
$template_pc = str_replace('<!--@DESCRIPTION@-->', $information->ic_seo_description, $template_pc);
|
|
|
|
|
$template_mobile = str_replace('<!--@KEYWORDS@-->', $information->ic_seo_keywords, $template_mobile);
|
|
|
|
|
$template_pc = str_replace('<!--@KEYWORDS@-->', $information->ic_seo_keywords, $template_pc);
|
|
|
|
|
$template_mobile = str_replace('<!--@CANONICAL@-->', $this->config->item('site_url') . $information->ic_url, $template_mobile);
|
|
|
|
|
$template_pc = str_replace('<!--@CANONICAL@-->', $this->config->item('site_url') . $information->ic_url, $template_pc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//顶部视频
|
|
|
|
|
$data['meta_news_video'] = get_meta($information->ic_id, 'meta_news_video');
|
|
|
|
|
$data['meta_video_picture'] = get_meta($information->ic_id, 'meta_video_picture');
|
|
|
|
|
if (empty($data['meta_news_video']) && empty($data['meta_video_picture'])) {
|
|
|
|
|
//没有顶部视频时候才读取全屏大图
|
|
|
|
|
//顶部全屏大图
|
|
|
|
|
if ($device == 'mobile') { //移动端读取移动大图
|
|
|
|
|
$data['meta_addon_picture'] = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
|
|
} else {
|
|
|
|
|
$data['meta_addon_picture'] = get_meta($information->ic_id, 'meta_addon_picture');
|
|
|
|
|
}
|
|
|
|
|
$data['meta_addon_picture_url'] = get_meta($information->ic_id, 'meta_addon_picture_url');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['author'] = $this->Operator_model->get_author_nikename($information->ic_author); //获取作者信息
|
|
|
|
|
$template_H1 = $this->load->view($template_path . '-h1', $data, TRUE);
|
|
|
|
|
$template_mobile = str_replace('<!--@HEAD_1@-->', $template_H1, $template_mobile);
|
|
|
|
|
$template_pc = str_replace('<!--@HEAD_1@-->', $template_H1, $template_pc);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function make_www_cache_ah($device, $information)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -812,6 +862,8 @@ class Information extends CI_Controller
|
|
|
|
|
$data['meta_addon_picture_url'] = get_meta($information->ic_id, 'meta_addon_picture_url');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article'));
|
|
|
|
|
$data['ads_by_google'] = $ads_by_google;
|
|
|
|
|
$data['author'] = $this->Operator_model->get_author_nikename($information->ic_author); //获取作者信息
|
|
|
|
|
$template_H1 = $this->load->view($template_path . '-h1', $data, TRUE);
|
|
|
|
|
$template = str_replace('<!--@HEAD_1@-->', $template_H1, $template);
|
|
|
|
@ -877,15 +929,18 @@ class Information extends CI_Controller
|
|
|
|
|
//if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) {
|
|
|
|
|
$template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="2509031466" data-matched-content-rows-num="2,2" data-matched-content-columns-num="1,3" data-matched-content-ui-type="image_stacked,image_stacked"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
|
|
|
|
|
//}
|
|
|
|
|
if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
|
|
|
|
|
$in_article_google = $this->load->view($template_path . '-google-ad', false, true);
|
|
|
|
|
$template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', $in_article_google, $template);
|
|
|
|
|
}
|
|
|
|
|
//社媒分享图片
|
|
|
|
|
|
|
|
|
|
$full_ic_photo='';
|
|
|
|
|
if (!empty($information->ic_photo)) {
|
|
|
|
|
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
|
|
|
|
|
}else{
|
|
|
|
|
$full_ic_photo = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
|
|
}
|
|
|
|
|
if(!empty($full_ic_photo)){
|
|
|
|
|
$template = str_replace('<!--@OG:IMAGE@-->', '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">', $template);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置图片尺寸
|
|
|
|
|
$template = $this->html_optimize_lib->set_image_size($template);
|
|
|
|
|
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
|
|
|
|
|