移动优先页面发布

ct-mobile-first
ycc 5 years ago
parent 7e62e30083
commit 958031e674

@ -388,7 +388,7 @@ $config['proxy_ips'] = '';
//各站信息组和人员权限分配
$config['site'] = array(
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('zzy', 'spt', 'yl', 'gavin', 'sw', 'zl', 'wbl', 'yqw', 'lf', 'zhm', 'pkl'), 'site_user' => ',ycc,lmr, zyh,J,shw,B,zzy,WJJ,Tony,pcf,zxy,wst,wz,v,S,yyg,yxd,wj,sw,yl,hx,spt,wmr,zl,syt,gavin,zm,htc,yqw,bhn,lmj,wbl,yqw,LYY,zhm,si'),
'ch' => array('site_code' => 'ch', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('TDJ'), 'site_user' => ',ycc,'),
'ch' => array('site_code' => 'ch', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('TDJ','ycc'), 'site_user' => ',ycc,'),
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com', 'site_image_url' => '//bilder.chinarundreisen.com', 'site_authors' => array('DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'), 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'),
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com', 'site_image_url' => '//images.voyageschine.com', 'site_authors' => array('JE', 'kq', 'lya', 'lyz', 'zyh'), 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com', 'site_image_url' => '//images.arachina.com', 'site_authors' => array('hql', 'LLM', 'SHX', 'lmr', 'zyh', 'zb'), 'site_user' => ',ycc,lmr, zyh,hql,LLM,SHX,htc,zpl,Tony,zyh,J,B,zb,LYY,'),
@ -714,6 +714,7 @@ $config['cache']['vc']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\voyageschine.com
$config['cache']['vac']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\viaje-a-china.com';
$config['cache']['ru']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\chinahighlights.ru';
$config['cache']['it']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\viaggio-in-cina.it';
$config['cache']['ch']['cache_path'] = 'D:\wwwcache\chinahighlights.com';
//静态文件更新接口
$config['cache']['jp']['cache_api'] = '/info.php/information/update_cache/';

@ -481,6 +481,9 @@ class Information extends CI_Controller
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)) {
//读取模板生成PC和移动优先文件
$this->make_mobile_html();
} 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)) {
@ -551,6 +554,29 @@ class Information extends CI_Controller
}
return true;
}
function make_mobile_html(){
//获取移动优先的模板,如果有的话
$mobile_first_template_path='mobile_first/'.$this->config->item('site_code');
if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){
$mobile_template=$this->load->view($mobile_first_template_path, '', TRUE);
}else{
return false;
}
$mobile_template=str_replace('<!--@TITLE@-->', $this->input->post('ic_seo_title'), $mobile_template);
$mobile_template=str_replace('<!--@DESCRIPTION@-->', $this->input->post('ic_seo_description'), $mobile_template);
$mobile_template=str_replace('<!--@KEYWORDS@-->', $this->input->post('ic_seo_keywords'), $mobile_template);
$mobile_template=str_replace('<!--@CANONICAL@-->', $this->input->post('ic_url'), $mobile_template);
$mobile_template=str_replace('<!--@CUSTOM-CONENT@-->', $this->input->post('ic_content'), $mobile_template);
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
$mobile_html=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url');
$mobile_html=str_replace("\\", "/", $mobile_html);
if(substr($mobile_html, -1, 1)== '/'){
$mobile_html=$mobile_html.'index.htm';
}
create_folder_by_path(dirname($mobile_html));
file_put_contents($mobile_html, $mobile_template, LOCK_EX);
}
//更新静态文件
//不用参数提交的原因是可能url带有特殊字符CI会报错

@ -1543,7 +1543,7 @@ foreach ($author_list as $author_item) {
<input type="checkbox" name="ignore_url_check" id="ignore_url_check" />忽略URL重复
</label>
<div class="clearfix"></div>
<?php if (in_array($this->config->item('site_code'), array('cht', 'gm','ah','ct'))) {?>
<?php if (in_array($this->config->item('site_code'), array('ch','cht', 'gm','ah','ct'))) {?>
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="auto_update_cache_checkbox" id="auto_update_cache_checkbox" onclick="get_update_cache_url();" value="<?php echo $information->ic_url; ?>" />静态更新
</label>
@ -1557,6 +1557,7 @@ foreach ($author_list as $author_item) {
echo '<i class="glyphicon glyphicon-hand-up" title="手动管理,不会自动更新"></i>';
}?>
</label>
<?php }?>
<div class="clearfix"></div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save