Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
6c390c10
Commit
6c390c10
authored
Jun 30, 2025
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新提交
parent
a5127559
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
17 deletions
+1
-17
server/app/Services/Traits/Msds/MsdsTrait.php
server/app/Services/Traits/Msds/MsdsTrait.php
+1
-17
No files found.
server/app/Services/Traits/Msds/MsdsTrait.php
View file @
6c390c10
...
@@ -141,26 +141,10 @@ trait MsdsTrait
...
@@ -141,26 +141,10 @@ trait MsdsTrait
}
}
preg_match
(
'/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i'
,
$msds_html
,
$bodyStyle
);
$msds_html
=
str_replace
(
"font-family: 'times_new_roman', 'Times New Roman', sans-serif"
,
"font-family: 'msyh'"
,
$msds_html
);
$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
=
preg_replace
(
'/<html>/i'
,
'<html lang="zh_CN no-js">'
,
$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('/<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
)){
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
);
$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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment