From ae6c935207f052ca6bc9f6b9b39f7a60e8f875ad Mon Sep 17 00:00:00 2001 From: LMR <59361885@qq.com> Date: Wed, 20 Mar 2024 09:57:46 +0800 Subject: [PATCH] add gm copy --- application/controllers/information.php | 343 ++++++++++++------------ 1 file changed, 178 insertions(+), 165 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 82b1e887..adf6a95e 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1,7 +1,7 @@ InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', ''); $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id); - if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { + if (!empty ($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { $is_id = $this->InfoStructures_model->insert_id; $InfoStructures = $this->InfoStructures_model->Detail($is_id); $InfoStructures->is_id = $is_id; @@ -84,7 +84,7 @@ class Information extends CI_Controller $data = array(); $is_id = $this->input->post('is_id'); $is_parent_id = $this->input->post('is_parent_id'); - if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) { + if ($is_id == $is_parent_id || empty ($is_id) || empty ($is_parent_id)) { return false; } //即将移动到文章结构信息 @@ -112,7 +112,7 @@ class Information extends CI_Controller public function copy_by_is_id($src_is_id, $dest_is_id) { $data = array(); - if ($src_is_id == $dest_is_id || empty($src_is_id) || empty($dest_is_id)) { + if ($src_is_id == $dest_is_id || empty ($src_is_id) || empty ($dest_is_id)) { return false; } // 源节点 @@ -186,27 +186,40 @@ class Information extends CI_Controller $item_meta_pccss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS_PC'); $item_meta_pcschema = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCHEMA'); - if (!empty($item_meta_amp)) + if (!empty ($item_meta_amp)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP', $item_meta_amp); - if (!empty($item_meta_ampbody)) + if (!empty ($item_meta_ampbody)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY', $item_meta_ampbody); - if (!empty($item_meta_ampcss)) + if (!empty ($item_meta_ampcss)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS', $item_meta_ampcss); - if (!empty($item_meta_ampscript)) + if (!empty ($item_meta_ampscript)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCRIPT', $item_meta_ampscript); - if (!empty($item_meta_ampjson)) + if (!empty ($item_meta_ampjson)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_JSON', $item_meta_ampjson); - if (!empty($item_meta_ampstatus)) + if (!empty ($item_meta_ampstatus)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_STATUS', $item_meta_ampstatus); - if (!empty($item_meta_pcstatus)) + if (!empty ($item_meta_pcstatus)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC_STATUS', $item_meta_pcstatus); - if (!empty($item_meta_pcbody)) + if (!empty ($item_meta_pcbody)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC', $item_meta_pcbody); - if (!empty($item_meta_pccss)) + if (!empty ($item_meta_pccss)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS_PC', $item_meta_pccss); - if (!empty($item_meta_pcschema)) + if (!empty ($item_meta_pcschema)) $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCHEMA', $item_meta_pcschema); + // gm 补充meta + $item_meta_addon_css = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_css'); + if (!empty ($item_meta_addon_css)) + $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_css', $item_meta_addon_css); + + $item_meta_addon_js = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_js'); + if (!empty ($item_meta_addon_js)) + $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_js', $item_meta_addon_js); + + $item_meta_use_list_picture = $this->InfoMetas_model->get($item->is_ic_id, 'meta_use_list_picture'); + if (!empty ($item_meta_use_list_picture)) + $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_use_list_picture', $item_meta_use_list_picture); + // 添加节点 $this->InfoStructures_model->Add_with_sitecode($target_is_id, $this->InfoContents_model->insert_id, 999, $dest->is_sitecode); $node_map[$item->is_id] = $this->InfoStructures_model->insert_id; @@ -248,7 +261,7 @@ class Information extends CI_Controller //} $this->Logs_model->delete($is_id, $info_detail->ic_content); - if (!empty($info_detail->ic_summary)) { + if (!empty ($info_detail->ic_summary)) { $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary); } $this->InfoStructures_model->Delete($Structure->is_id); @@ -296,7 +309,7 @@ class Information extends CI_Controller //检查该信息是否已收录 $data['embody'] = 1; - if (isset($data['information']->ic_id)) { + if (isset ($data['information']->ic_id)) { $embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody'); if ($embody && $embody != '1') { $data['embody'] = 0; @@ -506,13 +519,13 @@ class Information extends CI_Controller //AMP更新和生成 beign $auto_update_amp = $this->input->get_post('auto_update_amp'); - if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { + if (!empty ($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { $amp_result = $this->amplib->auto_create($information->ic_id); - if (!empty($amp_result)) { + if (!empty ($amp_result)) { $amp_result = json_decode($amp_result); if ($amp_result->result == 'ok') { $amp_save_result = $this->amplib->edit_save($information->ic_id, $amp_result->data->amp, '1'); - if (!empty($amp_save_result)) { + if (!empty ($amp_save_result)) { $amp_save_result = json_decode($amp_save_result); if ($amp_save_result->name == 'no') { echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误,请重新进入AMP编辑器检查')); @@ -525,7 +538,7 @@ class Information extends CI_Controller //AMP更新和生成 end //为新闻添加默认发布时间 $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate'); - if (empty($meta_news_createdate)) { + if (empty ($meta_news_createdate)) { add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time())); } @@ -544,9 +557,9 @@ class Information extends CI_Controller $ic_url = $this->input->post('ic_url'); $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox'); - if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) { + if (strcasecmp($site_code, "gm") == 0 && !empty ($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url, true); - } else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ch") == 0 && !empty ($auto_update_cache)) { //读取模板生成PC和移动优先文件 $information_new = $this->Information_model->Detail($this->input->post('is_id')); //$this->benchmark->mark('000'); @@ -555,36 +568,36 @@ class Information extends CI_Controller $this->make_www_cache('mobile', $information_new, $recommand_information); $this->make_www_cache('pc', $information_new, $recommand_information); //echo ' |000~111: '.$this->benchmark->elapsed_time('000', '111'); - } else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ah") == 0 && !empty ($auto_update_cache)) { //读取模板生成PC和移动优先文件 $recommand_information = $this->recommand_information($information); $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_ah('mobile', $information_new, $recommand_information); $this->make_www_cache_ah('pc', $information_new, $recommand_information); - } else if (strcasecmp($site_code, "gh") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "gh") == 0 && !empty ($auto_update_cache)) { $recommand_information = $this->recommand_information($information); $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_gh('mobile', $information_new, $recommand_information); $this->make_www_cache_gh('pc', $information_new, $recommand_information); - } else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)) { + } 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($information_new); // $this->make_www_cache_ct('pc', $information_new); - } else if (strcasecmp($site_code, "shanghai") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "shanghai") == 0 && !empty ($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_sh($information_new); - } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "cht") == 0 && !empty ($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); - } else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ah") == 0 && !empty ($auto_update_cache)) { //$update_info_log = $this->update_cache($ic_url); } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0 && strcasecmp($site_code, "ah") != 0) { //非cht站点并且非GM并且非AH $update_info_log = $this->update_cache($ic_url); - } else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ct") == 0 && !empty ($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); } - if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) { + if (empty ($update_info_log) || count($update_info_log) == 0 || !isset ($update_info_log[0]['url'])) { $update_info_log = 'not found update info log'; } @@ -612,7 +625,7 @@ class Information extends CI_Controller '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/', ); $key = $this->input->post('ic_author'); - if (isset($author_pages[$key])) { + if (isset ($author_pages[$key])) { $this->update_cache($author_pages[$key]); } } @@ -648,7 +661,7 @@ class Information extends CI_Controller public function update_www_cache($ic_id) { $information = $this->Information_model->detail_by_ic_id($ic_id); - if (empty($information)) { + if (empty ($information)) { echo json_encode(array('name' => 'no', 'data' => '找不到这个页面')); return false; } @@ -682,10 +695,10 @@ class Information extends CI_Controller //静态文件操作 public function html_file_helper($active = 'find', $ic_url = false) { - if (empty($ic_url)) { + if (empty ($ic_url)) { $ic_url = $this->input->get_post('ic_url'); } - if (empty($ic_url)) { + if (empty ($ic_url)) { return false; } $html_file = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $ic_url; @@ -770,7 +783,7 @@ class Information extends CI_Controller // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (!empty($feedback_array)) { + if (!empty ($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -793,7 +806,7 @@ class Information extends CI_Controller // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (!empty($feedback30_array)) { + if (!empty ($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { $city_name = $feedback30_array[1][$index]; $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name); @@ -813,7 +826,7 @@ class Information extends CI_Controller // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (!empty($feedback_city_array)) { + if (!empty ($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { $city_name_string = $feedback_city_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -868,7 +881,7 @@ class Information extends CI_Controller $data_TrainCity = array(); $data_TrainCity["from"] = ""; $data_TrainCity["to"] = ""; - if (!empty($meta_train_city)) { + if (!empty ($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; @@ -883,19 +896,19 @@ class Information extends CI_Controller $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); $meta_google_ad_article = get_meta($information->ic_id, 'meta_google_ad_article'); //非产品页面 - if (empty($meta_product_code)) { + if (empty ($meta_product_code)) { - $ads_by_google = !empty($meta_google_ad_article); + $ads_by_google = !empty ($meta_google_ad_article); //H1模板替换 $data_H1 = array(); $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)) { + 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_web)) { $data_H1['author'] = $author_web->a_name; } } @@ -955,14 +968,14 @@ class Information extends CI_Controller //本地 278035929 //网前 278008224 if ($information->is_parent_id == "278008224") { - if (!empty($meta_product_code)) { + if (!empty ($meta_product_code)) { //准备需要的数据 $dataTrippest = []; $dataTrippest["ic_title"] = $information->ic_title; //附加选项 $t_Type = get_meta($information->ic_id, 'meta_trippest_type'); - if (isset($t_Type)) { + if (isset ($t_Type)) { $dataTrippest["t_Type"] = $t_Type; } else { $dataTrippest["t_Type"] = "general"; @@ -1027,7 +1040,7 @@ class Information extends CI_Controller // $price = $this->trippest_model->get_price("BJALC-1",2); $price = $this->trippest_model->get_price($dataTrippest['PagDetail']->PAG_Code, 2); $showPrice = ""; - if (!empty($price)) { + if (!empty ($price)) { $PKP_AdultNetPrice = $price->PKP_AdultNetPrice; $PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice; if ($PKP_AdultSpecialPrice > 0) { @@ -1053,10 +1066,10 @@ 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,防止被插件屏蔽 - if (!empty($template_recommand['Tips Right TOP'])) { + if (!empty ($template_recommand['Tips Right TOP'])) { $template = str_replace('', "
", $template); } - if (!empty($template_recommand['Tips Right'])) { + if (!empty ($template_recommand['Tips Right'])) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } @@ -1109,7 +1122,7 @@ class Information extends CI_Controller } // 未勾选In Article 广告时,加入标签 ,让 ezoic 识别出该页面不展示广告。 - if (empty($meta_google_ad_article) || !$meta_google_ad_article) { + if (empty ($meta_google_ad_article) || !$meta_google_ad_article) { $template = str_replace( '', '', @@ -1126,7 +1139,7 @@ class Information extends CI_Controller //替换内容中广告 $temp_array = array(); preg_match_all('^^', $information->ic_content, $temp_array); - if (!empty($temp_array[1])) { + if (!empty ($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -1153,8 +1166,8 @@ class Information extends CI_Controller } $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); - if (!empty($meta_addon_picture)) { - if (!empty($meta_addon_picture_url)) { + if (!empty ($meta_addon_picture)) { + if (!empty ($meta_addon_picture_url)) { $template = str_replace('', '
' . $information->ic_title . '
', $template); } else { $template = str_replace('', '
' . $information->ic_title . '
@@ -1165,7 +1178,7 @@ class Information extends CI_Controller //顶部视频 $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); $meta_video_picture = get_meta($information->ic_id, 'meta_video_picture'); - if (!empty($meta_news_video) && !empty($meta_video_picture)) { + if (!empty ($meta_news_video) && !empty ($meta_video_picture)) { $template = str_replace('', '
', $template); } @@ -1186,7 +1199,7 @@ class Information extends CI_Controller } //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { + if (!empty ($meta_addon_css)) { if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { $meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); } else { @@ -1196,7 +1209,7 @@ class Information extends CI_Controller } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (!empty($meta_addon_js)) { + if (!empty ($meta_addon_js)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 @@ -1213,12 +1226,12 @@ class Information extends CI_Controller //} //社媒分享图片 $full_ic_photo = ''; - if (!empty($information->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)) { + if (!empty ($full_ic_photo)) { $template = str_replace('', '', $template); } //设置图片尺寸 @@ -1294,7 +1307,7 @@ class Information extends CI_Controller { $feedback30_array = []; preg_match_all('^^', '
', $feedback30_array); - if (!empty($feedback30_array)) { + if (!empty ($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { $city_name = $feedback30_array[1][$index]; $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 2); @@ -1319,7 +1332,7 @@ class Information extends CI_Controller { $feedback_city_array = []; preg_match_all('^^', '
', $feedback_city_array); - if (!empty($feedback_city_array)) { + if (!empty ($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { $city_name_string = $feedback_city_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -1369,13 +1382,13 @@ class Information extends CI_Controller { $price_item_array = $this->price_pregmatch($price_content); $price_tag_list = []; - if (!empty($price_item_array)) { + if (!empty ($price_item_array)) { foreach ($price_item_array as $price_item) { - $price_date = !empty($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格 + $price_date = !empty ($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格 $price_number = ''; //优先读取新的价格体系 $price = $this->PrimeLinePrice_model->search($price_item->cli_no, 1, $price_item->cli_grade, $price_item->person_size, $price_date, $dept_sn); - if (!empty($price)) { + if (!empty ($price)) { switch (strtoupper($price_item->price_people)) { case 'A': $price_number = $price->PLP_AdultUnitPrice; @@ -1397,7 +1410,7 @@ class Information extends CI_Controller } } else { $price = $this->Price_model->search($price_item->cli_no, 1, $price_item->cli_grade, false, $price_date); - if (!empty($price)) { + if (!empty ($price)) { switch (strtoupper($price_item->price_people)) { case 'A': @@ -1453,7 +1466,7 @@ class Information extends CI_Controller $site_money = $this->currency->calc_show_price($price_number); //把金额格式化为带有逗号(,)方便阅读,如 12,345 $price_number = is_numeric($price_number) ? number_format($site_money) : $price_number; - if (!empty($price_number)) { + if (!empty ($price_number)) { $price_tag = [ 'placeholder' => $price_item->placeholder, 'price_number' => $price_number, @@ -1478,11 +1491,11 @@ class Information extends CI_Controller $placeholder = $item; $item = str_replace('#', '', $item); $price_array = explode(',', $item); - $cli_no = !empty($price_array[0]) ? $price_array[0] : false; //线路代号 - if (empty($cli_no)) { + $cli_no = !empty ($price_array[0]) ? $price_array[0] : false; //线路代号 + if (empty ($cli_no)) { continue; //没有设置线路代号则进入下一条 } - $cli_grade = !empty($price_array[1]) ? $price_array[1] : false; //标准7001、豪华7002、经济7003 + $cli_grade = !empty ($price_array[1]) ? $price_array[1] : false; //标准7001、豪华7002、经济7003 switch (strtoupper($cli_grade)) { case 'ST': $cli_grade = '7001'; @@ -1496,7 +1509,7 @@ class Information extends CI_Controller default: $cli_grade = '7001'; } - $person_size = (!empty($price_array[2]) && is_numeric($price_array[2])) ? $price_array[2] : 2; //人等1,2-5,6-9,10,默认2人等 + $person_size = (!empty ($price_array[2]) && is_numeric($price_array[2])) ? $price_array[2] : 2; //人等1,2-5,6-9,10,默认2人等 //为了兼容以前的人等方式,把算数人等转换为单数 25=>2 switch ($person_size) { case '25': @@ -1506,8 +1519,8 @@ class Information extends CI_Controller $person_size = '6'; break; } - $price_date = !empty($price_array[3]) ? $price_array[3] : false; //价格时间 - $price_people = !empty($price_array[4]) ? $price_array[4] : 'A'; //A成人、C小孩、B婴儿、R单间房差 + $price_date = !empty ($price_array[3]) ? $price_array[3] : false; //价格时间 + $price_people = !empty ($price_array[4]) ? $price_array[4] : 'A'; //A成人、C小孩、B婴儿、R单间房差 $result[] = (object) array('placeholder' => $placeholder, 'cli_no' => $cli_no, 'cli_grade' => $cli_grade, 'person_size' => $person_size, 'price_date' => $price_date, 'price_people' => $price_people); } return $result; @@ -1578,18 +1591,18 @@ class Information extends CI_Controller } $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); - $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); + $ads_by_google = !empty (get_meta($information->ic_id, 'meta_google_ad_article')); //H1模板替换 $data_H1 = array(); $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)) { + 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_web)) { $data_H1['author'] = $author_web->a_name; } } @@ -1600,7 +1613,7 @@ class Information extends CI_Controller $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); $template = str_replace('', $template_H1, $template); - if (empty($meta_product_code)) { + if (empty ($meta_product_code)) { $addthis_widget = $this->load->view($template_path . '-add-this', false, true); $template = str_replace('', $addthis_widget, $template); } @@ -1612,13 +1625,13 @@ class Information extends CI_Controller ); $template = str_replace('', $article_structured_data_content, $template); - if (!empty($meta_product_code)) { + if (!empty ($meta_product_code)) { // $product_code_input = ""; $template = str_replace('', $product_code_input, $template); } - if (empty($meta_product_code)) { + if (empty ($meta_product_code)) { $template = str_replace('?product_code=', '', $template); } else { $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); @@ -1628,10 +1641,10 @@ 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,防止被插件屏蔽 - if (!empty($template_recommand['Tips Right TOP'])) { + if (!empty ($template_recommand['Tips Right TOP'])) { // $template = str_replace('', "
", $template); } - if (!empty($template_recommand['Tips Right'])) { + if (!empty ($template_recommand['Tips Right'])) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } // 右侧列表广告 @@ -1680,7 +1693,7 @@ class Information extends CI_Controller //替换内容中广告 $temp_array = array(); preg_match_all('^^', $information->ic_content, $temp_array); - if (!empty($temp_array[1])) { + if (!empty ($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -1702,7 +1715,7 @@ class Information extends CI_Controller ); $information->ic_content = str_replace('', $why_us_covid_list_mobile, $information->ic_content); - if (empty($meta_product_code)) { + if (empty ($meta_product_code)) { $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); } else { @@ -1730,7 +1743,7 @@ class Information extends CI_Controller // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (!empty($feedback30_array)) { + if (!empty ($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { $city_name = $feedback30_array[1][$index]; $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name); @@ -1750,7 +1763,7 @@ class Information extends CI_Controller // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (!empty($feedback_city_array)) { + if (!empty ($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { $city_name_string = $feedback_city_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -1794,7 +1807,7 @@ class Information extends CI_Controller $template = str_replace('', '', $template); //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { + if (!empty ($meta_addon_css)) { // if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { //$meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); // } else { @@ -1804,7 +1817,7 @@ class Information extends CI_Controller } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (!empty($meta_addon_js)) { + if (!empty ($meta_addon_js)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 @@ -1813,12 +1826,12 @@ class Information extends CI_Controller //社媒分享图片 $full_ic_photo = ''; - if (!empty($information->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)) { + if (!empty ($full_ic_photo)) { $template = str_replace('', '', $template); } //设置图片尺寸 @@ -1879,7 +1892,7 @@ class Information extends CI_Controller //顶部视频 $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 (empty ($data['meta_news_video']) && empty ($data['meta_video_picture'])) { //没有顶部视频时候才读取全屏大图 //顶部全屏大图 if ($device == 'mobile') { //移动端读取移动大图 @@ -1903,15 +1916,15 @@ class Information extends CI_Controller ]; $breadcrumb_data = $this->Information_model->get_breadcrumb_data($information->is_id, $information->is_path, $group_map); - $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); + $ads_by_google = !empty (get_meta($information->ic_id, 'meta_google_ad_article')); $data['ads_by_google'] = $ads_by_google; $data['author'] = ''; //获取作者信息 $author = $this->Operator_model->get_author_nikename($information->ic_author); - if (!empty($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_web)) { $data['author'] = $author_web->a_name; } } @@ -1941,7 +1954,7 @@ class Information extends CI_Controller $template_recommand = $recommand_information; $template = str_replace('', $this->load->view($recommand_template, array('recommands' => $template_recommand), true), $template); //广告,改叫tips,防止被插件屏蔽 - if (!empty($template_recommand['Tips Right'])) { + if (!empty ($template_recommand['Tips Right'])) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } // 右侧列表广告 @@ -2004,7 +2017,7 @@ class Information extends CI_Controller //替换内容中广告 $temp_array = array(); preg_match_all('^^', $information->ic_content, $temp_array); - if (!empty($temp_array[1])) { + if (!empty ($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -2015,7 +2028,7 @@ class Information extends CI_Controller $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); // 非产品页面 - if (empty($meta_product_code)) { + if (empty ($meta_product_code)) { $addthis_widget = $this->load->view($template_path . '-add-this', false, true); $template = str_replace('', $addthis_widget, $template); $template = str_replace('?product_code=', '', $template); @@ -2095,7 +2108,7 @@ class Information extends CI_Controller // 解析结果:; Siem Reap,Bangkok $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (!empty($feedback_array)) { + if (!empty ($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -2118,7 +2131,7 @@ class Information extends CI_Controller // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (!empty($feedback30_array)) { + if (!empty ($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { $city_name = $feedback30_array[1][$index]; $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name); @@ -2138,7 +2151,7 @@ class Information extends CI_Controller // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (!empty($feedback_city_array)) { + if (!empty ($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { $city_name_string = $feedback_city_array[1][$index]; $city_name_list = explode(',', $city_name_string); @@ -2184,14 +2197,14 @@ class Information extends CI_Controller $template = str_replace('', '', $template); //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { + if (!empty ($meta_addon_css)) { //内联方式 $meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css)); $template = str_replace('', '', $template); } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (!empty($meta_addon_js)) { + if (!empty ($meta_addon_js)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 @@ -2205,12 +2218,12 @@ class Information extends CI_Controller //社媒分享图片 $full_ic_photo = ''; - if (!empty($information->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)) { + if (!empty ($full_ic_photo)) { $template = str_replace('', '', $template); } @@ -2270,8 +2283,8 @@ class Information extends CI_Controller //作者字符串,信息页或者城市天气页加载 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'; + 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 = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } @@ -2326,7 +2339,7 @@ class Information extends CI_Controller $data["FloatIcon"] = ""; //浮动图标替代addthis $arrExitUrl = array("/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"); - if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { + if (empty (get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { //$data["addthis_widget"] = $this->load->view($template_path . '-add-this', false, true); //社媒代码addthis $data["FloatIcon"] = ""; } else { @@ -2338,7 +2351,7 @@ class Information extends CI_Controller $data["TOPVIDEO"] = ""; $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); $meta_video_picture = get_meta($information->ic_id, 'meta_video_picture'); - if (!empty($meta_news_video) && !empty($meta_video_picture)) { + if (!empty ($meta_news_video) && !empty ($meta_video_picture)) { $data["TOPVIDEO"] = ''; } @@ -2352,7 +2365,7 @@ class Information extends CI_Controller //额外样式 $data["ADDONCSS"] = ""; $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { + if (!empty ($meta_addon_css)) { //引用方式 //$data["ADDONCSS"]= ''; //内联方式 @@ -2361,7 +2374,7 @@ class Information extends CI_Controller } //社媒分享图片 $data["OGIMAGE"] = ""; - if (!empty($information->ic_photo)) { + if (!empty ($information->ic_photo)) { if (strpos($information->ic_photo, "chinatravel.com") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -2373,7 +2386,7 @@ class Information extends CI_Controller //结构化标签 $data["ConstructionCode"] = ""; $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (!empty($meta_construction_code)) { + if (!empty ($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } @@ -2396,7 +2409,7 @@ class Information extends CI_Controller //额外js $data["ADDONJS"] = ""; $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (!empty($meta_addon_js)) { + if (!empty ($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -2437,11 +2450,11 @@ class Information extends CI_Controller $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (!empty($meta_ct_page_type)) { + if (!empty ($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (!empty($meta_ct_page_value)) { + if (!empty ($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; @@ -2452,7 +2465,7 @@ class Information extends CI_Controller //线路 $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (!empty($meta_ct_page_value)) { + if (!empty ($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } @@ -2472,7 +2485,7 @@ class Information extends CI_Controller if ($meta_ct_page_type == "cruisedetails") { $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (!empty($meta_ct_page_value)) { + if (!empty ($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $dataCruise["shipname"] = $productCode; @@ -2507,17 +2520,17 @@ class Information extends CI_Controller if ($device == 'mobile') { //移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $bannerImg = '' . $information->ic_title . ''; - if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { + if (!empty ($meta_addon_picture_url) && !empty ($meta_addon_picture_text)) { $ImgText = ''; - } else if (!empty($meta_addon_picture_text)) { + } else if (!empty ($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); $bannerImg = '' . $information->ic_title . ''; - if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { + if (!empty ($meta_addon_picture_url) && !empty ($meta_addon_picture_text)) { $ImgText = ''; - } else if (!empty($meta_addon_picture_text)) { + } else if (!empty ($meta_addon_picture_text)) { $ImgText = ''; } } @@ -2544,8 +2557,8 @@ class Information extends CI_Controller } } - if (!empty($meta_addon_picture)) { - if (!empty($meta_addon_picture_url)) { + if (!empty ($meta_addon_picture)) { + if (!empty ($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -2633,8 +2646,8 @@ class Information extends CI_Controller //作者字符串,信息页或者城市天气页加载 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'; + 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 = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } @@ -2659,7 +2672,7 @@ class Information extends CI_Controller $data["FloatIcon"] = ""; //浮动图标替代addthis $arrExitUrl = array("/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"); - if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { + if (empty (get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; } else { $data["ISPRODUCT"] = "yes"; @@ -2669,7 +2682,7 @@ class Information extends CI_Controller $data["TOPVIDEO"] = ""; $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); $meta_video_picture = get_meta($information->ic_id, 'meta_video_picture'); - if (!empty($meta_news_video) && !empty($meta_video_picture)) { + if (!empty ($meta_news_video) && !empty ($meta_video_picture)) { $data["TOPVIDEO"] = ''; } @@ -2683,7 +2696,7 @@ class Information extends CI_Controller //额外样式 $data["ADDONCSS"] = ""; $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { + if (!empty ($meta_addon_css)) { //引用方式 //$data["ADDONCSS"]= ''; //内联方式 @@ -2692,7 +2705,7 @@ class Information extends CI_Controller } //社媒分享图片 $data["OGIMAGE"] = ""; - if (!empty($information->ic_photo)) { + if (!empty ($information->ic_photo)) { if (strpos($information->ic_photo, "shanghaihighlights.com") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -2704,7 +2717,7 @@ class Information extends CI_Controller //结构化标签 $data["ConstructionCode"] = ""; $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (!empty($meta_construction_code)) { + if (!empty ($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } @@ -2727,7 +2740,7 @@ class Information extends CI_Controller //额外js $data["ADDONJS"] = ""; $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (!empty($meta_addon_js)) { + if (!empty ($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -2768,11 +2781,11 @@ class Information extends CI_Controller $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (!empty($meta_ct_page_type)) { + if (!empty ($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (!empty($meta_ct_page_value)) { + if (!empty ($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; @@ -2789,7 +2802,7 @@ class Information extends CI_Controller //线路 $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (!empty($meta_ct_page_value)) { + if (!empty ($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } @@ -2843,17 +2856,17 @@ class Information extends CI_Controller if ($device == 'mobile') { //移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $bannerImg = '' . $information->ic_title . ''; - if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { + if (!empty ($meta_addon_picture_url) && !empty ($meta_addon_picture_text)) { $ImgText = ''; - } else if (!empty($meta_addon_picture_text)) { + } else if (!empty ($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); $bannerImg = '' . $information->ic_title . ''; - if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { + if (!empty ($meta_addon_picture_url) && !empty ($meta_addon_picture_text)) { $ImgText = ''; - } else if (!empty($meta_addon_picture_text)) { + } else if (!empty ($meta_addon_picture_text)) { $ImgText = ''; } } @@ -2880,8 +2893,8 @@ class Information extends CI_Controller } } - if (!empty($meta_addon_picture)) { - if (!empty($meta_addon_picture_url)) { + if (!empty ($meta_addon_picture)) { + if (!empty ($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -2930,9 +2943,9 @@ class Information extends CI_Controller //通过内容找到第一张图片 public function set_photo_content($ic_photo, $ic_content) { - if (empty($ic_photo)) { + if (empty ($ic_photo)) { $images = get_image_url_by_source($ic_content); - if (!empty($images) and !empty($images[1])) { + if (!empty ($images) and !empty ($images[1])) { return $images[1][0]; } } else { @@ -2961,7 +2974,7 @@ class Information extends CI_Controller break; case 'rule_this_node_random': //指定节点下随机 $ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id, 'is_path'); - if (!empty($ir_pointer)) { + if (!empty ($ir_pointer)) { $data = $this->Information_model->random(1, $ir_pointer->is_path, $exclude_ids); } break; @@ -2978,18 +2991,18 @@ class Information extends CI_Controller return false; } //读取备用节点 - if (empty($data) && !empty($recommand->ir_urls)) { //查不到信息并且备选urls不为空,则随机选一条 + if (empty ($data) && !empty ($recommand->ir_urls)) { //查不到信息并且备选urls不为空,则随机选一条 // $url_array = explode("\n", $recommand->ir_urls); // $data = $this->Information_model->Detail(trim($url_array[rand(0, count($url_array) - 1)])); $url_array = explode("\n", $recommand->ir_urls); $data = $this->Information_model->random_range(1, $url_array, $exclude_ids); } - if (!empty($data)) { + if (!empty ($data)) { $exclude_ids[] = $data->is_id; $data->desktop_photo = get_meta($data->ic_id, 'meta_addon_picture'); $data->mobile_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); - if (empty($data->mobile_photo)) { - if (!empty($data->ic_photo)) { + if (empty ($data->mobile_photo)) { + if (!empty ($data->ic_photo)) { $data->mobile_photo = $this->config->item('site_image_url') . $data->ic_photo; } else { $data->mobile_photo = 'https://data.chinahighlights.com/image/travelguide/article/recommended-info-bottom-cover.jpg'; @@ -3014,7 +3027,7 @@ class Information extends CI_Controller $exclude_ids = array(0); } $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); - if (!empty($result)) { + if (!empty ($result)) { $data += $result; } } @@ -3023,9 +3036,9 @@ class Information extends CI_Controller if ($this->config->item('site_code') == 'ah' or $this->config->item('site_code') == 'ch' or $this->config->item('site_code') == 'gh') { //如果是AH CH GH的页面,取消重复检测 $exclude_ids = array(0); } - if (empty($data[$item->ir_name])) { + if (empty ($data[$item->ir_name])) { $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); - if (!empty($result)) { + if (!empty ($result)) { $data += $result; } } @@ -3045,12 +3058,12 @@ class Information extends CI_Controller case 278008010: //Inspiration //随机获取两个同级节点内容 $random_array = $this->Information_model->random(2, $data['root_detail']->is_path, array($data['detail']->is_id)); - if (!empty($random_array[0])) { + if (!empty ($random_array[0])) { $data['info_howtoplan'] = $random_array[0]; $data['info_howtoplan_root'] = $data['root_detail']; $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); } - if (!empty($random_array[1])) { + if (!empty ($random_array[1])) { $data['info_besttime'] = $random_array[1]; $data['info_besttime_root'] = $data['root_detail']; $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); @@ -3069,7 +3082,7 @@ class Information extends CI_Controller '/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'])) { + if (!empty ($data['info_topthings'])) { $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); } @@ -3086,7 +3099,7 @@ class Information extends CI_Controller '/travelguide/chinese-language/', ); $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); - if (!empty($data['info_hotel'])) { + if (!empty ($data['info_hotel'])) { $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); } @@ -3098,29 +3111,29 @@ class Information extends CI_Controller $destination_url = substr($destination_url, 0, strpos($destination_url, '/', 1) + 1); //how to plan $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, array('how', 'plan'), array($data['detail']->is_id)); - if (empty($data['info_howtoplan'])) { //找不到对应信息则显示备用 + if (empty ($data['info_howtoplan'])) { //找不到对应信息则显示备用 $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); } $data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (!empty($data['info_howtoplan'])) { + if (!empty ($data['info_howtoplan'])) { $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); } //best time to visit $data['info_besttime'] = $this->Information_model->search_by_words($destination_url, array('best', 'time'), array($data['detail']->is_id)); - if (empty($data['info_besttime'])) { + if (empty ($data['info_besttime'])) { $data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm'); } $data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (!empty($data['info_besttime'])) { + if (!empty ($data['info_besttime'])) { $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); } //top things to do $data['info_topthings'] = $this->Information_model->search_by_words($destination_url, array('top', 'things'), array($data['detail']->is_id)); - if (empty($data['info_topthings'])) { + if (empty ($data['info_topthings'])) { $data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); } $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (!empty($data['info_topthings'])) { + if (!empty ($data['info_topthings'])) { $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); } //第四篇,随机推荐下方url @@ -3133,7 +3146,7 @@ class Information extends CI_Controller '/aboutus/company-history.htm', ); $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); - if (!empty($data['info_hotel'])) { + if (!empty ($data['info_hotel'])) { $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); } @@ -3149,10 +3162,10 @@ class Information extends CI_Controller //不用参数提交的原因是可能url带有特殊字符,CI会报错 public function update_cache($static_html_url = false, $delete_only = false) { - $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); + $url = !empty ($static_html_url) ? $static_html_url : $this->input->post('cache_url'); $url = str_replace($this->config->item('site_url'), '', $url); $original_url = $url; //原始链接 - $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only'); + $delete_only = !empty ($delete_only) ? $delete_only : $this->input->get_post('delete_only'); switch ($this->config->item('site_code')) { case 'cht': @@ -3204,13 +3217,13 @@ class Information extends CI_Controller $tmp = $url; //判断是否是更新信息 // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 - if (!empty($information->ic_content) || !empty($information->ic_summary) || $meta_pc_amp == 'yes') { + if (!empty ($information->ic_content) || !empty ($information->ic_summary) || $meta_pc_amp == 'yes') { $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; } else { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; } - if (isset($information->ic_type) && $information->ic_type == 'product') { + if (isset ($information->ic_type) && $information->ic_type == 'product') { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; } //int return direct @@ -3256,18 +3269,18 @@ class Information extends CI_Controller $tmp = $url; //判断是否是更新信息 // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 - if (!empty($information->ic_content) || !empty($information->ic_summary) || $meta_pc_amp == 'yes') { + if (!empty ($information->ic_content) || !empty ($information->ic_summary) || $meta_pc_amp == 'yes') { $url = $this->config->item('site_url') . '/index.php/gh/info/detail/?static_html_url=' . $url; } else { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; } - if (isset($information->ic_type) && $information->ic_type == 'product') { + if (isset ($information->ic_type) && $information->ic_type == 'product') { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; } // GH国际 不发布的时候删除缓存 - if (isset($information) && !empty($information) && !$information->ic_status) { + if (isset ($information) && !empty ($information) && !$information->ic_status) { $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $tmp; } @@ -3345,14 +3358,14 @@ 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); - if (isset($tempu['host'])) { - $url = isset($tempu['path']) ? $tempu['path'] : '/'; + if (isset ($tempu['host'])) { + $url = isset ($tempu['path']) ? $tempu['path'] : '/'; $pad = $tempu['host']; $flag = true; } //如果传递进来的url没有域名,则使用当前站点的信息进行判断