|
|
@ -23,7 +23,9 @@ class Index_gm extends CI_Controller
|
|
|
|
$this->debug = $this->input->post('debug');
|
|
|
|
$this->debug = $this->input->post('debug');
|
|
|
|
|
|
|
|
|
|
|
|
/*$this->htmlsource = file_get_contents('aa.htm');
|
|
|
|
/*$this->htmlsource = file_get_contents('aa.htm');
|
|
|
|
$this->websitehost = 'https://data.chinarundreisen.com';*/
|
|
|
|
$this->websitehost = 'https://data.chinarundreisen.com';
|
|
|
|
|
|
|
|
$this->create_amp = 'true';
|
|
|
|
|
|
|
|
$this->template_name = 'gm';*/
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($this->htmlsource) || empty($this->websitehost)) {
|
|
|
|
if (empty($this->htmlsource) || empty($this->websitehost)) {
|
|
|
|
$this->output->set_status_header(500);
|
|
|
|
$this->output->set_status_header(500);
|
|
|
@ -296,6 +298,27 @@ class Index_gm extends CI_Controller
|
|
|
|
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
|
|
|
|
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//产品页面多做一些特殊的处理
|
|
|
|
|
|
|
|
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
|
|
|
|
|
|
|
|
$amp_template = str_replace($tabnav, '', $amp_template);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//产品页面删除表单
|
|
|
|
|
|
|
|
foreach ($this->html_object->find('.sticky') as $sticky) {
|
|
|
|
|
|
|
|
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($this->html_object->find('form') as $form) {
|
|
|
|
|
|
|
|
$amp_template = str_replace($form, '', $amp_template);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!empty($form)){
|
|
|
|
|
|
|
|
$replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>';
|
|
|
|
|
|
|
|
$amp_template = str_replace('<style amp-custom>',$replace_text, $amp_template);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//产品页面处理结束
|
|
|
|
|
|
|
|
|
|
|
|
$link_css_array = array();
|
|
|
|
$link_css_array = array();
|
|
|
|
$css_content = '';
|
|
|
|
$css_content = '';
|
|
|
|
foreach ($this->html_object->find('link') as $link_css) {
|
|
|
|
foreach ($this->html_object->find('link') as $link_css) {
|
|
|
@ -312,6 +335,11 @@ class Index_gm extends CI_Controller
|
|
|
|
if(strpos($item,'base.css')){
|
|
|
|
if(strpos($item,'base.css')){
|
|
|
|
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
|
|
|
|
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(strpos($item,'reiseroute.css')){
|
|
|
|
|
|
|
|
$item = 'https://data.chinarundreisen.com/min/?f=/css/reiseroute-amp.css';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
|
|
|
|
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
|
|
|
|
if ($get_http_temp == false) {
|
|
|
|
if ($get_http_temp == false) {
|
|
|
|
$this->output->set_status_header(404);
|
|
|
|
$this->output->set_status_header(404);
|
|
|
@ -342,7 +370,8 @@ class Index_gm extends CI_Controller
|
|
|
|
|
|
|
|
|
|
|
|
//替换掉写在组件上的样式
|
|
|
|
//替换掉写在组件上的样式
|
|
|
|
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
|
|
|
|
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
|
|
|
|
echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp_template)));
|
|
|
|
echo $amp_template;
|
|
|
|
|
|
|
|
//echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp_template)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//格式化url,保证请求的URL有域名,//更换为对应的域名路径
|
|
|
|
//格式化url,保证请求的URL有域名,//更换为对应的域名路径
|
|
|
|