优化德语amp转换程序

hotfix/远程访问多媒体中心
cyc 6 years ago
parent 1ef23a171b
commit 038936b645

@ -284,6 +284,7 @@ class Index_gm extends CI_Controller
} }
} }
//只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) { foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template); $amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
} }
@ -300,6 +301,10 @@ class Index_gm extends CI_Controller
//循环下载所有的css样式拼接成字符串 //循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) { foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if(strpos($item,'base.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.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);
@ -310,6 +315,11 @@ class Index_gm extends CI_Controller
$css_content .= $get_http_temp; $css_content .= $get_http_temp;
} }
foreach ($html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
}
//把网页内容和css提交到purifycss处理 //把网页内容和css提交到purifycss处理
$purifycss_server = 'http://158.177.67.52:33033/'; $purifycss_server = 'http://158.177.67.52:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST'); $optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST');

Loading…
Cancel
Save