Commit 6c390c10 authored by hj's avatar hj

更新提交

parent a5127559
......@@ -141,26 +141,10 @@ trait MsdsTrait
}
preg_match('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i',$msds_html, $bodyStyle);
$bodyStyle['bodyStyle'] = "<style>body{ font-family: 'msyh'; font-size: 0.8rem; font-weight: normal; display: block;} h2{font-size: 2.0rem; text-align: center;}.container { padding-right: 5px;padding-left: 5px;margin-right: auto;margin-left: auto;width: 100%;} .sds-cn dd p { font-weight: normal; margin-left: 20px; }" .
$bodyStyle['bodyStyle']."</style><body>";
// 格式化处理
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.b-a[\s]*?\{[\s]*?border: 1px solid #000000;[\s]*?\}/i', '.sds-cn .b-a { border: 1px solid #000000; margin-left:10px;}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;[\s]*?\}/i', '.sds-cn dd.clearfix { width:80% }', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?dt[\s]*?\{[\s]*?float: left; font-weight: bold; clear: left; [\s]*?\}/i', '.sds-cn dt { float: left; font-weight: normal; clear: left; }', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.list-line[\s]*?li:before[\s]*?\{ content: " —— " \}/i', '.sds-cn .list-line li:before { content: " -- " }', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?p[\s]*?\{[\s]*?margin:[\s]*?0; \}/i', '.sds-cn p { margin: 0 15px;word-wrap:break-word; }', $bodyStyle['bodyStyle']);
$msds_html = str_replace("font-family: 'times_new_roman', 'Times New Roman', sans-serif", "font-family: 'msyh'", $msds_html);
$msds_html = preg_replace('/<html>/i', '<html lang="zh_CN no-js">', $msds_html);
//$msds_html = preg_replace('/<meta[\s]*?charset=[\"]UTF\-8[\"]/i', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">', $msds_html);
$msds_html = preg_replace('/<body><style>(?<bodyStyle>[\s\S]*?)<\/style>/i', '@body@', $msds_html);
$msds_html = preg_replace('/<\/body>/', '</body>', preg_replace('/@body@/', $bodyStyle['bodyStyle'], $msds_html));
//$msds_html = preg_replace('/@body@/', $newMsdsHtml, $msds_html);
if(preg_match('/<div[\s]*?class=[\\\'|\"]sds-ghs[\\\'|\"]>/i', $msds_html)){
$msds_html = str_replace('<div class="sds-ghs">','<div class="sds-ghs"><h2 style="height:100px;margin: 1.83em 0"><img src="'.$params['company_logo'].'" style="text-align:center;height:90px;"></h2>', $msds_html);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment