From f347e74be0be95712c5afb34d46500919f090e2f Mon Sep 17 00:00:00 2001 From: LMR <59361885@qq.com> Date: Mon, 20 Mar 2023 11:42:59 +0800 Subject: [PATCH] fix content --- application/controllers/information.php | 224 +++++++++++------------- 1 file changed, 106 insertions(+), 118 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 16f8c775..2a2560d5 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1,12 +1,13 @@ permission->is_admin(); @@ -49,7 +50,7 @@ class Information extends CI_Controller $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); } echo json_encode($data); - return TRUE; + return true; } //移动结构顺序 @@ -70,7 +71,7 @@ class Information extends CI_Controller $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); echo json_encode($data); $this->Logs_model->move($idsStr); - return TRUE; + return true; } //把文章移动到任意板块文章下 @@ -98,14 +99,14 @@ class Information extends CI_Controller $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move')); echo json_encode($data); $this->Logs_model->move($is_id); - return TRUE; + return true; } public function delete($is_id) { //查询结构信息 $Structure = $this->InfoStructures_model->Detail($is_id); - if ($Structure == FALSE) { + if ($Structure == false) { $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound')); echo json_encode($data); return false; @@ -135,22 +136,23 @@ class Information extends CI_Controller } //删除成功后返回一个上级链接给用户 $drumpurl = site_url('information/edit/' . $Structure->is_parent_id); - if ($Structure->is_parent_id == 0) + if ($Structure->is_parent_id == 0) { $drumpurl = site_url('/'); + } + $data[] = array('name' => 'ok', 'value' => $drumpurl); echo json_encode($data); return true; } } - public function edit($is_id) { set_time_limit(30); //$this->output->enable_profiler(true); //查询结构信息 $Structure = $this->InfoStructures_model->Detail($is_id); - if ($Structure == FALSE) { + if ($Structure == false) { show_404(); } //查询结构根节点 @@ -207,7 +209,6 @@ class Information extends CI_Controller $this->config->set_item('templates', $this->config->item('templates_gm')); } - if ($Structure->is_sitecode == 'ct') { $data['infoTypeList'] = $this->config->item('InfoType_ct'); } elseif ($Structure->is_sitecode == 'ah') { @@ -254,7 +255,6 @@ class Information extends CI_Controller } } - $data['templateList'] = $this->config->item('templates'); //翰特产品类型 $data['productTypeList'] = $this->config->item('ProductType_HT'); @@ -307,7 +307,7 @@ class Information extends CI_Controller if (is_mobile_first()) { $mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) { - $data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', TRUE); + $data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', true); //主样式表,内联模式 $main_css_string = compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css')); $data['mobile_first_template'] = str_replace('', '', $data['mobile_first_template']); @@ -328,13 +328,11 @@ class Information extends CI_Controller } } - $this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/information_edit'); $this->load->view('bootstrap3/footer'); } - public function edit_save() { header('Cache-Control: no-cache'); @@ -356,7 +354,7 @@ class Information extends CI_Controller $this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required'); $this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]'); } - if ($this->form_validation->run() == FALSE) { + if ($this->form_validation->run() == false) { $data = array(); foreach ($this->form_validation->_error_array as $key => $value) { $data[] = array('name' => $key, 'value' => $value); @@ -474,7 +472,7 @@ class Information extends CI_Controller '210000021' => 'http://www.chinahighlights.com/author/matthew/', '200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/', '202000018' => 'http://www.chinahighlights.com/author/klaus-capra/', - '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/' + '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/', ); $key = $this->input->post('ic_author'); if (isset($author_pages[$key])) { @@ -487,7 +485,7 @@ class Information extends CI_Controller } //URL不重复检查 - function ic_url_check() + public function ic_url_check() { if ($this->input->post('ignore_url_check')) { return true; @@ -502,7 +500,7 @@ class Information extends CI_Controller } //URL格式检查,不能包含大小写、空格等特殊字符 - function ic_url_format($url) + public function ic_url_format($url) { if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) { return false; @@ -543,7 +541,7 @@ class Information extends CI_Controller } //静态文件操作 - function html_file_helper($active = 'find', $ic_url = false) + public function html_file_helper($active = 'find', $ic_url = false) { if (empty($ic_url)) { $ic_url = $this->input->get_post('ic_url'); @@ -583,7 +581,7 @@ class Information extends CI_Controller } //生成静态文件 $device='mobile' or 'pc' - function make_www_cache($device, $information, $recommand_information) + public function make_www_cache($device, $information, $recommand_information) { $data = array(); switch ($device) { @@ -591,7 +589,7 @@ class Information extends CI_Controller //获取移动优先的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . EXT)) { - $template = $this->load->view($template_path, '', TRUE); + $template = $this->load->view($template_path, '', true); $html_path_ext = '-mobile.htm'; } else { return false; @@ -601,7 +599,7 @@ class Information extends CI_Controller //获取PC的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) { - $template = $this->load->view($template_path . '-pc', '', TRUE); + $template = $this->load->view($template_path . '-pc', '', true); $html_path_ext = '-pc.htm'; } else { return false; @@ -666,7 +664,7 @@ class Information extends CI_Controller //火车票搜索框添加 -- zp if ($information->is_parent_id == "278008234") { //本地测试的火车父类ID为:278035939 。网前为:278008234 - $template_TrainSearch = $this->load->view($template_path . '-train-detail', null, TRUE); + $template_TrainSearch = $this->load->view($template_path . '-train-detail', null, true); $template = str_replace('', $template_TrainSearch, $template); } @@ -695,7 +693,7 @@ class Information extends CI_Controller $data_H1['breadcrumb_data'] = $breadcrumb_data; $data_H1['ads_by_google'] = $ads_by_google; $data_H1['ic_datetime'] = $information->ic_datetime; - $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); + $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); $template = str_replace('', $template_H1, $template); $addthis_widget = $this->load->view($template_path . '-add-this', false, true); @@ -708,7 +706,6 @@ class Information extends CI_Controller ); $template = str_replace('', $article_structured_data_content, $template); - $article_top_image_content = $this->load->view( $template_path . '-info-top-img', array('information' => $information), @@ -756,11 +753,11 @@ class Information extends CI_Controller //获取翰特对应信息 $dataTrippest['PagDetail'] = $this->trippest_model->get_pagdetail($meta_product_code); //所属那个目的地 select SYC_SN,SYC2_CodeDiscribe from dbo.V_System_Code where SYC_Type=132 and LGC_LGC=2 - // 132001 北京目的地 - // 132002 上海目的地 - // 132003 西安目的地 - // 132004 桂林目的地 - // 132005 成都目的地 + // 132001 北京目的地 + // 132002 上海目的地 + // 132003 西安目的地 + // 132004 桂林目的地 + // 132005 成都目的地 $PAG_SourceType = $dataTrippest['PagDetail']->PAG_SourceType; switch ($PAG_SourceType) { case '132001': @@ -826,7 +823,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); + $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), true), $template); // //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right TOP'])) { $template = str_replace('', "
", $template); @@ -836,11 +833,11 @@ class Information extends CI_Controller } //文中的信息推荐 if (strpos($information->ic_content, '') !== false) { - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands' => $template_recommand), TRUE), $information->ic_content); + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands' => $template_recommand), true), $information->ic_content); } //文中的线路推荐 if (strpos($information->ic_content, '') !== false) { - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content); + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), true), $information->ic_content); } // 未勾选In Article 广告时,加入标签 ,让 ezoic 识别出该页面不展示广告。 @@ -880,14 +877,13 @@ class Information extends CI_Controller // 火车票首页搜索框 --zp $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); + $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); if ($device == "mobile") { //手机端的搜索框直接显示,不再加背景图,这样可以保证CLS分数。 $template = str_replace('', '
' . $template_TrainSearch . '
', $template); } } - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); if (!empty($meta_addon_picture)) { if (!empty($meta_addon_picture_url)) { @@ -963,8 +959,7 @@ class Information extends CI_Controller file_put_contents($html_path, $template, LOCK_EX); } - - function make_www_cache_gh($device, $information, $recommand_information) + public function make_www_cache_gh($device, $information, $recommand_information) { $data = array(); switch ($device) { @@ -972,7 +967,7 @@ class Information extends CI_Controller //获取移动优先的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . EXT)) { - $template = $this->load->view($template_path, '', TRUE); + $template = $this->load->view($template_path, '', true); $html_path_ext = '-mobile.htm'; } else { return false; @@ -982,7 +977,7 @@ class Information extends CI_Controller //获取PC的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) { - $template = $this->load->view($template_path . '-pc', '', TRUE); + $template = $this->load->view($template_path . '-pc', '', true); $html_path_ext = '-pc.htm'; } else { return false; @@ -995,12 +990,12 @@ class Information extends CI_Controller $group_map = [ 278009289 => [ 'ic_url' => '/destinations', - 'ic_url_title' => 'Destinations' + 'ic_url_title' => 'Destinations', ], 278009290 => [ 'ic_url' => '/about', - 'ic_url_title' => 'About Us' - ] + 'ic_url_title' => 'About Us', + ], ]; $breadcrumb_data = $this->Information_model->get_breadcrumb_data($information->is_id, $information->is_path, $group_map); @@ -1059,7 +1054,7 @@ class Information extends CI_Controller $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); + $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); $template = str_replace('', $template_H1, $template); if (empty($meta_product_code)) { @@ -1082,7 +1077,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); + $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), true), $template); // //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right TOP'])) { // $template = str_replace('', "
", $template); @@ -1179,8 +1174,7 @@ class Information extends CI_Controller file_put_contents($html_path, $template, LOCK_EX); } - - function make_www_cache_ah($device, $information, $recommand_information) + public function make_www_cache_ah($device, $information, $recommand_information) { $data = array(); @@ -1190,7 +1184,7 @@ class Information extends CI_Controller //获取移动优先的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . EXT)) { - $template = $this->load->view($template_path, '', TRUE); + $template = $this->load->view($template_path, '', true); $html_path_ext = '-mobile.htm'; } else { return false; @@ -1200,7 +1194,7 @@ class Information extends CI_Controller //获取PC的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) { - $template = $this->load->view($template_path . '-pc', '', TRUE); + $template = $this->load->view($template_path . '-pc', '', true); $html_path_ext = '-pc.htm'; } else { return false; @@ -1233,12 +1227,12 @@ class Information extends CI_Controller $group_map = [ 278002667 => [ 'ic_url' => '/destinations', - 'ic_url_title' => 'Destinations' + 'ic_url_title' => 'Destinations', ], 278008885 => [ 'ic_url' => '/about-us', - 'ic_url_title' => 'About Us' - ] + 'ic_url_title' => 'About Us', + ], ]; $breadcrumb_data = $this->Information_model->get_breadcrumb_data($information->is_id, $information->is_path, $group_map); @@ -1255,7 +1249,7 @@ class Information extends CI_Controller } } $data['breadcrumb_data'] = $breadcrumb_data; - $template_H1 = $this->load->view($template_path . '-h1', $data, TRUE); + $template_H1 = $this->load->view($template_path . '-h1', $data, true); $template = str_replace('', $template_H1, $template); // 结构化标签:Article $article_structured_data_content = $this->load->view( @@ -1279,18 +1273,18 @@ class Information extends CI_Controller //推荐信息或者产品 //信息推荐 $template_recommand = $recommand_information; // $this->recommand_information($information); - $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); + $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), true), $template); //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right'])) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } //文中的信息推荐 if (strpos($information->ic_content, '') !== false) { - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands' => $template_recommand), TRUE), $information->ic_content); + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands' => $template_recommand), true), $information->ic_content); } //文中的线路推荐 if (strpos($information->ic_content, '') !== false) { - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content); + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), true), $information->ic_content); } //替换内容中广告 @@ -1418,7 +1412,6 @@ class Information extends CI_Controller $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.asiahighlights.com/grey.gif'); $template = str_replace('', $lazy_content, $template); - //Google广告代码 //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { $template = str_replace('', '', $template); @@ -1482,13 +1475,13 @@ class Information extends CI_Controller * @return: * @Date Changed: */ - function make_www_cache_ct($information) + public function make_www_cache_ct($information) { $data = array(); #region 公用数据 //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 - $apiurl = "https://ct.mycht.cn/info.php"; //网前 + $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,CT采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 $data["TITLE"] = $information->ic_seo_title; @@ -1521,10 +1514,10 @@ class Information extends CI_Controller } //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 - $template_TrainDetailSearch=""; + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || $information->is_parent_id == "278014609") { - $template_TrainDetailSearch = $this->load->view($template_path . '-train-detail', null, TRUE); + $template_TrainDetailSearch = $this->load->view($template_path . '-train-detail', null, true); } /* 详细内容 */ @@ -1533,9 +1526,9 @@ class Information extends CI_Controller #region old replace // /**替换详细内容里面的价格 /* 直接使用fetch来动态获取价格,这样不用替换标签,直接录标签 - // * // 一日游价格标签, "" 或者 逗号后面是人数 - // * //精华线路标签"" - // */ + // * // 一日游价格标签, "" 或者 逗号后面是人数 + // * //精华线路标签"" + // */ // $ic_content = preg_replace_callback('//i',function($match){ // //处理一日游每次配备 // $matchItem = $match[1]; @@ -1549,12 +1542,12 @@ class Information extends CI_Controller #enregion /** 替换H1加面包屑,加作者 */ - $ic_content = preg_replace('/

(.*)<\/h1>/i', $crumb . "\r\n" . '

$1

' . "\r\n" . $str_author .$template_TrainDetailSearch . "\r\n", $ic_content, 1); + $ic_content = preg_replace('/

(.*)<\/h1>/i', $crumb . "\r\n" . '

$1

' . "\r\n" . $str_author . $template_TrainDetailSearch . "\r\n", $ic_content, 1); /**替换zodiac标签 */ if (strpos($ic_content, '') !== false) { $zodiacCalc = $this->load->view('mobile_first/' . $this->config->item('site_code') . '-zodiac-calc', false, true); - $ic_content = str_replace('', $zodiacCalc, $ic_content); + $ic_content = str_replace('', $zodiacCalc, $ic_content); } //图片加延迟 @@ -1564,7 +1557,6 @@ class Information extends CI_Controller $data["CUSTOMCONENT"] = $ic_content; - //非产品页面 $data["PRODUCTJS"] = ""; $data["ISPRODUCT"] = "no"; //判断是否是产品页 @@ -1576,7 +1568,6 @@ class Information extends CI_Controller $data["ISPRODUCT"] = "yes"; } - //顶部视频 $data["TOPVIDEO"] = ""; $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); @@ -1585,7 +1576,6 @@ class Information extends CI_Controller $data["TOPVIDEO"] = ''; } - //主样式表,内联模式 //$apiweb="http://202.103.68.104"; //本地测试 $apiweb = "https://data.chinatravel.com"; @@ -1624,7 +1614,7 @@ class Information extends CI_Controller //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 $addBaseJs = false; $addonJs = ""; - $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 + $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { $addBaseJs = true; @@ -1658,7 +1648,6 @@ class Information extends CI_Controller $addonJs .= ''; } - //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, array("daytripindex", "tourindex", "attractionindex", "weatherpage"))) { //一日游和线路列表 @@ -1673,12 +1662,10 @@ class Information extends CI_Controller $passParam .= ''; } - //加信息平台的is_id $passParam .= ''; } - //产品详细页 $productType = ""; $productCode = ""; @@ -1710,8 +1697,8 @@ class Information extends CI_Controller //调取模板 $dataform["TourCode"] = $productCode; $dataform["CLI_SN"] = $tourdata->clisn; - $dataform["TourName"] = $information->ic_title;; - $template_form_tourqi = $this->load->view($template_path . '-form-tourqi', $dataform, TRUE); + $dataform["TourName"] = $information->ic_title; + $template_form_tourqi = $this->load->view($template_path . '-form-tourqi', $dataform, true); $data["template_form_tourqi"] = $template_form_tourqi; //表单模板字符串 } @@ -1724,7 +1711,7 @@ class Information extends CI_Controller $productCode = $meta_ct_page_value; } $dataCruise["shipname"] = $productCode; - $template_curisedetails = $this->load->view($template_path . '-cruisedetails-form', $dataCruise, TRUE); + $template_curisedetails = $this->load->view($template_path . '-cruisedetails-form', $dataCruise, true); $data["template_curisedetails"] = $template_curisedetails; } @@ -1738,7 +1725,6 @@ class Information extends CI_Controller $data["productType"] = $productType; $data["productCode"] = $productCode; - //页面添加的元素 $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; @@ -1775,7 +1761,7 @@ class Information extends CI_Controller $template_TrainSearch = ""; if ($information->ic_url == "/china-trains/hometest" || $information->ic_url == "/china-trains") { //火车票首页 - $template_TrainSearch = $this->load->view($template_path . '-train-index', null, TRUE); + $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { @@ -1784,7 +1770,7 @@ class Information extends CI_Controller } } else if ($information->ic_url == "/china-flights") { //机票首页 - $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, TRUE); + $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { @@ -1801,14 +1787,13 @@ class Information extends CI_Controller } } - //两种设备分别调用两种模板 ,静态化 switch ($device) { case 'mobile': //获取移动优先的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . EXT)) { - $template = $this->load->view($template_path, $data, TRUE); + $template = $this->load->view($template_path, $data, true); $html_path_ext = '-mobile.htm'; } else { return false; @@ -1818,7 +1803,7 @@ class Information extends CI_Controller //获取PC的模板,如果有的话 $template_path = 'mobile_first/' . $this->config->item('site_code'); if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) { - $template = $this->load->view($template_path . '-pc', $data, TRUE); + $template = $this->load->view($template_path . '-pc', $data, true); $html_path_ext = '-pc.htm'; } else { return false; @@ -1827,7 +1812,6 @@ class Information extends CI_Controller default: } - //生成静态文件 $html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url; $html_path = str_replace("\\", "/", $html_path); @@ -1843,7 +1827,7 @@ class Information extends CI_Controller } //通过内容找到第一张图片 - function set_photo_content($ic_photo, $ic_content) + public function set_photo_content($ic_photo, $ic_content) { if (empty($ic_photo)) { $images = get_image_url_by_source($ic_content); @@ -1857,7 +1841,7 @@ class Information extends CI_Controller } //根据推荐规则进行查询 - function recommand_information_rule($information, $root_information, $recommand, &$exclude_ids) + public function recommand_information_rule($information, $root_information, $recommand, &$exclude_ids) { $data = array(); switch ($recommand->ir_rule) { @@ -1890,7 +1874,7 @@ class Information extends CI_Controller return array($recommand->ir_name => false); break; default: //'rule_parent'://继承上级规则则留空,程序会循环一遍分组的规则 - return false;; + return false; } //读取备用节点 if (empty($data) && !empty($recommand->ir_urls)) { //查不到信息并且备选urls不为空,则随机选一条 @@ -1915,7 +1899,7 @@ class Information extends CI_Controller } //获取当前信息所有的推荐信息和广告内容 - function recommand_information($information) + public function recommand_information($information) { $data = array(); $group_detail = $this->Information_model->get_detail_by_path($information->is_path, 0); //信息所属分组,根据分组进行不同推荐 @@ -1944,7 +1928,7 @@ class Information extends CI_Controller return $data; } - function call_mobile_template_NEXT($template_path, $is_id) + public function call_mobile_template_NEXT($template_path, $is_id) { $data['detail'] = $this->Information_model->Detail($is_id); $data['type_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 0); //信息所属分组,根据分组进行不同推荐 @@ -1975,7 +1959,7 @@ class Information extends CI_Controller '/travelguide/article-what-chinese-eat-for-breakfast.htm', '/travelguide/china-top-10-attractions.htm', '/travelguide/chinese-food/eight-chinese-dishes.htm', - '/travelguide/china-travel-reopen-restrictions.htm' + '/travelguide/china-travel-reopen-restrictions.htm', ); $data['info_topthings'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); if (!empty($data['info_topthings'])) { @@ -1992,7 +1976,7 @@ class Information extends CI_Controller '/travelguide/kungfu/', '/travelguide/culture/china-history.htm', '/travelguide/chinese-food/', - '/travelguide/chinese-language/' + '/travelguide/chinese-language/', ); $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); if (!empty($data['info_hotel'])) { @@ -2039,7 +2023,7 @@ class Information extends CI_Controller '/travelguide/article-private-tour-vs-group-tour.htm', '/aboutus/who-recommended.htm', '/aboutus/no-shops.htm', - '/aboutus/company-history.htm' + '/aboutus/company-history.htm', ); $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); if (!empty($data['info_hotel'])) { @@ -2051,10 +2035,9 @@ class Information extends CI_Controller return ''; } - return $this->load->view($template_path . '-next', $data, TRUE); + return $this->load->view($template_path . '-next', $data, true); } - //更新静态文件 //不用参数提交的原因是可能url带有特殊字符,CI会报错 public function update_cache($static_html_url = false, $delete_only = false) @@ -2067,11 +2050,11 @@ class Information extends CI_Controller switch ($this->config->item('site_code')) { case 'cht': $search_list = $this->Information_model->search_url($url); - $amp_request = FALSE; + $amp_request = false; foreach ($search_list as $key => $req_url) { $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS'); if ($meta_amp_status) { - $amp_request = TRUE; + $amp_request = true; } } if ($amp_request) { @@ -2126,20 +2109,20 @@ class Information extends CI_Controller $cache_url = $this->input->post('cache_url'); if ($url && !$cache_url) { /* - ignore_user_abort(true); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_TIMEOUT, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 - curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD - curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_exec($ch); + ignore_user_abort(true); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 + curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); + curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_exec($ch); curl_close($ch); - */ + */ $data['async_update'] = $url; $data[] = array('name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url); //如果是外部调用就返回结果,内部就不返回了 @@ -2180,7 +2163,7 @@ class Information extends CI_Controller $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice; } } - $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url, 'content' => $content); + $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url); } //如果是外部调用就返回结果,内部就不返回了 if ($this->input->post('cache_url')) { @@ -2196,8 +2179,9 @@ class Information extends CI_Controller $update_site = array('jp', 'ru'); //需要更新CDN的站点 //需要更新的url $url = $static_html_url; - if (empty($url)) + if (empty($url)) { $url = $this->input->post('cache_url'); + } //如果传递进来的url是带有域名,则对域名进行判断 $tempu = parse_url($url); @@ -2209,8 +2193,10 @@ class Information extends CI_Controller else { $url = str_replace($this->config->item('site_url'), '', $url); $pad = str_replace('http://', '', $this->config->item('site_url')); - if (in_array($this->config->item('site_code'), $update_site)) - $flag = TRUE; + if (in_array($this->config->item('site_code'), $update_site)) { + $flag = true; + } + } //默认更新成功,如果不成功,则返回错误提示信息 @@ -2218,14 +2204,16 @@ class Information extends CI_Controller if ($flag) { $result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json'); $result = json_decode($result, true); - if ($result['resultCode'] != 200) + if ($result['resultCode'] != 200) { $notice = $result['notice'] . $result['details']; + } + } return $notice; } //获取产品信息,提供给用户选择进行绑定 - function get_products() + public function get_products() { $HT_productType = $this->input->post('product_type'); $HT_productName = $this->input->post('product_name'); @@ -2247,7 +2235,7 @@ class Information extends CI_Controller } //显示备份的内容 - function backup_content($log_id) + public function backup_content($log_id) { $data['log_info'] = $this->Logs_model->read($log_id); if ($data['log_info']->log_action == 'backup_amp') { @@ -2261,7 +2249,7 @@ class Information extends CI_Controller } //保存自定义配置 - function save_meta() + public function save_meta() { $im_ic_id = $this->input->post('im_ic_id'); $im_key = $this->input->post('im_key'); @@ -2282,7 +2270,7 @@ class Information extends CI_Controller } //保存自定义配置 - function delete_meta() + public function delete_meta() { $im_ic_id = $this->input->post('im_ic_id'); $im_key = $this->input->post('im_key'); @@ -2296,4 +2284,4 @@ class Information extends CI_Controller echo json_encode($data); return true; } -} \ No newline at end of file +}