diff --git a/application/controllers/information.php b/application/controllers/information.php index a446d7b3..3909f64e 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -364,9 +364,9 @@ class Information extends CI_Controller echo json_encode($data); } else { $ic_content = $this->input->post('ic_content'); - if (strcasecmp($this->config->item('site_code'), "chinatravel") == 0){ //ct站替换中国大陆的英文 - if (stripos($ic_content, 'mainland china') !== false){ - $ic_content = str_ireplace('mainland china','the mainland of china',$ic_content); + if (strcasecmp($this->config->item('site_code'), "chinatravel") == 0) { //ct站替换中国大陆的英文 + if (stripos($ic_content, 'mainland china') !== false) { + $ic_content = str_ireplace('mainland china', 'the mainland of china', $ic_content); } } @@ -614,11 +614,13 @@ class Information extends CI_Controller $breadcrumb_structured_data_content = $this->load->view( $template_path . '-structured-data-breadcrumb', array('breadcrumb_data' => $breadcrumb_data, 'information' => $information), - true); + true + ); $template = str_replace( '', $breadcrumb_structured_data_content, - $template); + $template + ); //替换模板中的标签 $template = str_replace('', $information->ic_seo_title, $template); @@ -639,11 +641,13 @@ class Information extends CI_Controller $feedback_content = $this->load->view( $template_path . '-feedback-list', array('feedback_list' => $feedback_list), - true); + true + ); $information->ic_content = str_replace( $tag_name, $feedback_content, - $information->ic_content); + $information->ic_content + ); } } @@ -651,11 +655,13 @@ class Information extends CI_Controller $weather_forecast_content = $this->load->view( $template_path . '-weather-forecast', array(), - true); + true + ); $information->ic_content = str_replace( '', $weather_forecast_content, - $information->ic_content); + $information->ic_content + ); //火车票搜索框添加 -- zp if ($information->is_parent_id == "278008234") { @@ -675,11 +681,11 @@ class Information extends CI_Controller $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 $data_H1['author'] = ''; //获取作者信息 $author = $this->Operator_model->get_author_nikename($information->ic_author); - if(!empty($author)){ - $data_H1['author']=$author->OPI_FirstName; - }else{ - $author_web =$this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if(!empty($author_web)){ + if (!empty($author)) { + $data_H1['author'] = $author->OPI_FirstName; + } else { + $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 + if (!empty($author_web)) { $data_H1['author'] = $author_web->a_name; } } @@ -698,14 +704,16 @@ class Information extends CI_Controller $article_structured_data_content = $this->load->view( $template_path . '-structured-data-article', array('information' => $information, 'author' => $author), - true); + true + ); $template = str_replace('', $article_structured_data_content, $template); - + $article_top_image_content = $this->load->view( $template_path . '-info-top-img', array('information' => $information), - true); + true + ); $template = str_replace('', $article_top_image_content, $template); $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); @@ -811,7 +819,6 @@ class Information extends CI_Controller // print_r($trippest_detail_template); // die(); $information->ic_content = str_replace('', $trippest_detail_template, $information->ic_content); - } } @@ -820,7 +827,7 @@ class Information extends CI_Controller //信息推荐 $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); -// //广告,改叫tips,防止被插件屏蔽 + // //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right TOP'])) { $template = str_replace('', "
", $template); } @@ -838,15 +845,17 @@ class Information extends CI_Controller // 未勾选In Article 广告时,加入标签 ,让 ezoic 识别出该页面不展示广告。 if (empty($meta_google_ad_article) || !$meta_google_ad_article) { - $template = str_replace( - '', - '', - $template); + $template = str_replace( + '', + '', + $template + ); } else { - $template = str_replace( - '', - '', - $template); + $template = str_replace( + '', + '', + $template + ); } //替换内容中广告 @@ -872,7 +881,7 @@ class Information extends CI_Controller $template_TrainSearch = ""; if ($information->ic_url == "/china-trains/hometest.htm" || $information->ic_url == "/china-trains/") { $template_TrainSearch = $this->load->view($template_path . '-train-index', null, TRUE); - if ($device=="mobile"){ + if ($device == "mobile") { //手机端的搜索框直接显示,不再加背景图,这样可以保证CLS分数。 $template = str_replace('', ' ', $template); } @@ -894,7 +903,7 @@ class Information extends CI_Controller $template = str_replace('', '', $template); } - if (is_file('D:/wwwroot/origin-data.chinahighlights.com/css/mobile-first.css')) {//主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 + if (is_file('D:/wwwroot/origin-data.chinahighlights.com/css/mobile-first.css')) { //主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/mobile-first.css')); } else { $main_css_string = compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css')); @@ -998,20 +1007,24 @@ class Information extends CI_Controller $breadcrumb_structured_data_content = $this->load->view( $template_path . '-structured-data-breadcrumb', array('breadcrumb_data' => $breadcrumb_data, 'information' => $information), - true); + true + ); $template = str_replace( '', $breadcrumb_structured_data_content, - $template); + $template + ); $tour_form_content = $this->load->view( $template_path . '-tour-form', array('information' => $information), - true); + true + ); $template = str_replace( '', $tour_form_content, - $template); + $template + ); //替换模板中的标签 $template = str_replace('', $information->ic_seo_title, $template); @@ -1033,17 +1046,17 @@ class Information extends CI_Controller $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 $data_H1['author'] = ''; //获取作者信息 $author = $this->Operator_model->get_author_nikename($information->ic_author); - - if(!empty($author)){ - $data_H1['author']=$author->OPI_FirstName; - }else{ - $author_web =$this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if(!empty($author_web)){ + + if (!empty($author)) { + $data_H1['author'] = $author->OPI_FirstName; + } else { + $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 + if (!empty($author_web)) { $data_H1['author'] = $author_web->a_name; } } $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $meta_addon_picture;//$information->ic_photo; 用额外设置的图片替代 + $data_H1['ic_photo'] = $meta_addon_picture; //$information->ic_photo; 用额外设置的图片替代 $data_H1['breadcrumb_data'] = $breadcrumb_data; $data_H1['ads_by_google'] = $ads_by_google; $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); @@ -1057,7 +1070,8 @@ class Information extends CI_Controller $article_structured_data_content = $this->load->view( $template_path . '-structured-data-article', array('information' => $information, 'author_name' => $data_H1['author']), - true); + true + ); $template = str_replace('', $article_structured_data_content, $template); if (!empty($meta_product_code)) { @@ -1069,7 +1083,7 @@ class Information extends CI_Controller //信息推荐 $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); -// //广告,改叫tips,防止被插件屏蔽 + // //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right TOP'])) { // $template = str_replace('', "", $template); } @@ -1096,18 +1110,24 @@ class Information extends CI_Controller } } } - + $why_us_covid_list_pc = $this->load->view( - $template_path . '-why-us-covid-list-pc', array(), true); + $template_path . '-why-us-covid-list-pc', + array(), + true + ); $information->ic_content = str_replace('', $why_us_covid_list_pc, $information->ic_content); $why_us_covid_list_mobile = $this->load->view( - $template_path . '-why-us-covid-mobile', array(), true); + $template_path . '-why-us-covid-mobile', + array(), + true + ); $information->ic_content = str_replace('', $why_us_covid_list_mobile, $information->ic_content); $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); $information->ic_content = str_replace('', $info_page_form_content, $information->ic_content); - if (is_file('D:/wwwroot/origin-www.globalhighlights.com/css/gh-global.css')) {//主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 + if (is_file('D:/wwwroot/origin-www.globalhighlights.com/css/gh-global.css')) { //主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-www.globalhighlights.com/css/gh-global.css')); } else { $main_css_string = compress_css(GET_HTTP('https://www.globalhighlights.com/css/gh-global.css')); @@ -1131,7 +1151,7 @@ class Information extends CI_Controller //设置内容图片缓加载 $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.chinahighlights.com/grey.gif'); $template = str_replace('', $lazy_content, $template); - + //社媒分享图片 $full_ic_photo = ''; if (!empty($information->ic_photo)) { @@ -1226,11 +1246,11 @@ class Information extends CI_Controller $data['ads_by_google'] = $ads_by_google; $data['author'] = ''; //获取作者信息 $author = $this->Operator_model->get_author_nikename($information->ic_author); - if(!empty($author)){ - $data['author']=$author->OPI_FirstName; - }else{ - $author_web =$this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if(!empty($author_web)){ + if (!empty($author)) { + $data['author'] = $author->OPI_FirstName; + } else { + $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 + if (!empty($author_web)) { $data['author'] = $author_web->a_name; } } @@ -1241,21 +1261,24 @@ class Information extends CI_Controller $article_structured_data_content = $this->load->view( $template_path . '-structured-data-article', array('information' => $information, 'author' => $author), - true); + true + ); $template = str_replace('', $article_structured_data_content, $template); // 结构化标签:BreadcrumbList $breadcrumb_structured_data_content = $this->load->view( $template_path . '-structured-data-breadcrumb', array('breadcrumb_data' => $breadcrumb_data, 'information' => $information), - true); + true + ); $template = str_replace( '', $breadcrumb_structured_data_content, - $template); + $template + ); //推荐信息或者产品 //信息推荐 - $template_recommand = $recommand_information;// $this->recommand_information($information); + $template_recommand = $recommand_information; // $this->recommand_information($information); $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right'])) { @@ -1289,28 +1312,31 @@ class Information extends CI_Controller $template = str_replace('', $addthis_widget, $template); $template = str_replace('?product_code=', '', $template); } else { - $template = str_replace('?product_code=', '?product_code='.$meta_product_code, $template); + $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $inquiry_form_template = $this->load->view( - $template_path . '-inquiry-form', - array('meta_product_code' => $meta_product_code, 'information' => $information), - true); + $template_path . '-inquiry-form', + array('meta_product_code' => $meta_product_code, 'information' => $information), + true + ); $information->ic_content = str_replace('', $inquiry_form_template, $information->ic_content); // GP 表单 $gp_form_content = $this->load->view( - $template_path . '-gp-form', - array('meta_product_code' => $meta_product_code, 'information' => $information), - true); + $template_path . '-gp-form', + array('meta_product_code' => $meta_product_code, 'information' => $information), + true + ); $information->ic_content = str_replace('', $gp_form_content, $information->ic_content); // 水灯节 GP 线路表单 $gp_form_content = $this->load->view( - $template_path . '-lantern-festival-gp-form', - array('meta_product_code' => $meta_product_code, 'information' => $information), - true); - $information->ic_content = str_replace('', $gp_form_content, $information->ic_content); + $template_path . '-lantern-festival-gp-form', + array('meta_product_code' => $meta_product_code, 'information' => $information), + true + ); + $information->ic_content = str_replace('', $gp_form_content, $information->ic_content); } - // why-us 相关的标签 + // why-us 相关的标签 $why_us_mobile = $this->load->view($template_path . '-why-us-mobile', false, true); $information->ic_content = str_replace('', $why_us_mobile, $information->ic_content); @@ -1325,15 +1351,17 @@ class Information extends CI_Controller // 水灯节表单 $lantern_form_content = $this->load->view( - $template_path . '-lantern-form', - array('information' => $information), - true); + $template_path . '-lantern-form', + array('information' => $information), + true + ); $information->ic_content = str_replace('', $lantern_form_content, $information->ic_content); // 水灯节在信息页面表单 $lantern_form_info_page_content = $this->load->view( - $template_path . '-lantern-form-info-page', - array('information' => $information), - true); + $template_path . '-lantern-form-info-page', + array('information' => $information), + true + ); $information->ic_content = str_replace('', $lantern_form_info_page_content, $information->ic_content); // 动态加载反馈标签,第一个城市不足八条,使用第二城市数据。 @@ -1349,16 +1377,18 @@ class Information extends CI_Controller $feedback_content = $this->load->view( $template_path . '-feedback-list', array('feedback_list' => $feedback_list), - true); + true + ); $information->ic_content = str_replace( $tag_name, $feedback_content, - $information->ic_content); + $information->ic_content + ); } } //主样式表,内联模式 - if (is_file('D:/wwwroot/origin-www.asiahighlights.com/css/mobile-first.css')) {//主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 + if (is_file('D:/wwwroot/origin-www.asiahighlights.com/css/mobile-first.css')) { //主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-www.asiahighlights.com/css/mobile-first.css')); } else { $main_css_string = compress_css(GET_HTTP('https://proxy-data.asiahighlights.com/css/mobile-first.css')); @@ -1414,7 +1444,8 @@ class Information extends CI_Controller file_put_contents($html_path, $template, LOCK_EX); } - public function test_ah_feedback() { + public function test_ah_feedback() + { $feedback_array = []; preg_match_all('^^', '', $feedback_array); if (!empty($feedback_array)) { @@ -1426,7 +1457,8 @@ class Information extends CI_Controller $feedback_content = $this->load->view( 'mobile_first/ah' . '-feedback-list', array('feedback_list' => $feedback_list), - true); + true + ); echo $feedback_content; // $information->ic_content = str_replace( // $tag_name, @@ -1471,12 +1503,12 @@ class Information extends CI_Controller } $data["crumb"] = $crumb; - //作者字符串,信息页或者城市天气页加载 2022-7-26 - $str_author=""; + //作者字符串,信息页或者城市天气页加载 2022-7-26 + $str_author = ""; $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type=="weatherpage"){ - $OPI_FirstName = !empty($author)?$author->OPI_FirstName:'author nickname'; - $str_author = ' ' ; + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = ' '; } /* 详细内容 */ @@ -1498,11 +1530,11 @@ class Information extends CI_Controller // },$ic_content); /** 替换H1加面包屑,加作者 */ - $ic_content = preg_replace('/